'3. Implementation/Windows Mobile'에 해당되는 글 6건

  1. 2010.01.09 App 개발시 Security 관련
  2. 2009.07.22 Pocket PC Tools : RCE 외 Pocket PC 용 App 및 소스
  3. 2008.09.05 Detect an ActiveSync connection on a device
  4. 2008.09.05 How do I find when active sync device has connected/disconnected- PC side
  5. 2008.09.02 Visual Studio .NET 2005 에서 에뮬레이터와 PC간에 연결 문제 해결
  6. 2008.08.31 WAP & WML
2010. 1. 9. 06:43

App 개발시 Security 관련

다음을 참고하여 App 실행 또는 RAPI 에서 Dll 실행시 Warning 이 뜨지 않도록 하자.

Windows Mobile 6.0 & VS2008을 사용할 경우
 :ActiveSync 연결된 상태에서 Device Security Manager를 실행시키고 security configuratoin을 변경한다.

Windows Mobile 6.0 & VS2005를 사용할 경우
2가지 케이스가 가능하다.
- security model을 바꾸는 방법
  . 이경우 device 가 lock되었다면 바꿀수 없음. 만약 그렇지 않다면 ActiveSync연결후 \Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\SDKTools <- 요 폴더로 이동후 아래 명령 실행.
  . securityfile은 \Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\SDKTools\SecurityModels\ 에 Locked.xml prompt.xml open.xml등이 있음. 우리는 개발용으로 안물어보게 하는것이 목적이므로 open.xml을 선택.
RapiConfig.exe /P /M <securityfile.xml>
- app를 signing해서 deploy 시키는 방법
  . project property 창을 연후에.  Authenticode Signing->Certificate 선택. 다이얼로그 뜨면 Manager certificate선택. \Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\SDKTools\TestCertificates\TestCert_Privileged.pfx 선택.


Window Mobile 5.0인경우
 :M$에서 security configuration manager를 다운 받아서 실행시킨다.

출처 : http://nberserk.tistory.com/entry/security-configuration-manager

다음을 설치하여 보안을 아예 해제할 수 있다. (좀 위험해 보인다.)
: T-Omina 용이라는데...


출처 : http://leoncafe.tistory.com/45


2009. 7. 22. 15:30

Pocket PC Tools : RCE 외 Pocket PC 용 App 및 소스

2008. 9. 5. 06:09

Detect an ActiveSync connection on a device

 

Detecting an ActiveSync connection - rmut

11-Mar-07 06:33:02

I have a .NET CF 2.0 application running on a Windows Mobile 2003 (Pocket PC)

device, and I need to detect an ActiveSync connection.

 

I've looked into IDccMan/IDccManSink but that only works on the desktop side

(correct me if I'm wrong).  Then I developed a service that polls the

isn't very efficient.

 

Is there a way I can have an event raised when the registry key changes?  I

think this is possible in Windows Mobile 5.0, but I don't see a similar

function in the Windows Mobile 2003 API.

 

Otherwise, feel free to suggest a better way to detect an ActiveSync

connection.  I'd like to avoid depending on third-party APIs though.

 

Thanks in advance.

 

Detecting an ActiveSync connection - Peter Foot [MVP]

11-Mar-07 07:58:38

You can use CeRunAppAtEvent with NOTIFICATION_EVENT_ON_AC_POWER or

NOTIFICATION_EVENT_RS232_DETECTED events. See the documentation for having

this trigger a named event then use WaitForSingleObject in a worker thread

in your application.

 

Peter

 

--

Peter Foot

 

Detecting an ActiveSync connection - RaduMotisa

12-Mar-07 12:40:08

rmuti,

 

on 2003 devices the correct aproach is to use RAS to check for the

ActiveSync connection.

 

There is a complete sample here:

http://teksoftco.com/forum/viewtopic.php?t=249 , but you will need to call

native functions from your C# code.

 

Regards,

Radu

 

Detecting an ActiveSync connection - rmut

12-Mar-07 02:14:18

Thanks.  This does what I need.

 

Detecting an ActiveSync connection - rmut

12-Mar-07 02:18:05

Thanks, but I not only want to check for an ActiveSync connection, I want to

be notified when a connection is established.  I want an event-based approach

versus a polling approach.  CeRunAppAtEvent seems to work well, so I think

I'll stick with that.

Determine Active Connection (name and type)

 

bool ConnectedViaActiveSync()//this will work on 2002,2003 and 2003 SE devices only
{
DWORD aConnections = 0,
pConnections = 0;
DWORD dwResult = 0;

pRasEntryName = (RASENTRYNAME*)malloc(sizeof(RASENTRYNAME));
pRasEntryName[0].dwSize = sizeof(RASENTRYNAME);

pRasConn = (RASCONN*)malloc(sizeof(RASCONN));
pRasConn[0].dwSize = sizeof(RASCONN);

cb = sizeof(RASCONN);
if ( RasEnumConnections(pRasConn, &cb, &aConnections) == ERROR_SUCCESS)
{
cb = sizeof(RASENTRYNAME);
if ( RasEnumEntries(NULL, NULL, pRasEntryName, &cb, &pConnections) ==
ERROR_BUFFER_TOO_SMALL)
{
free(pRasEntryName);
pRasEntryName = NULL;
pRasEntryName = (RASENTRYNAME*)malloc(cb*sizeof(BYTE));
pRasEntryName[0].dwSize = sizeof(RASENTRYNAME);
}
if ( RasEnumEntries(NULL, NULL,pRasEntryName, &cb, &pConnections) != ERROR_SUCCESS) {
free(pRasEntryName);
pRasEntryName = NULL;
free(pRasConn);
pRasConn = NULL;
return 0;
}
else
{
if (aConnections)
{
for(UINT possible = 0; possible <(UINT)pConnections; possible++)
for(UINT active = 0; active <(UINT)aConnections; active++)
if (_tcscmp(pRasEntryName[possible].szEntryName, pRasConn[active].szEntryName) == 0)
{
DWORD dwError = 0;
if (RasGetConnectStatus(pRasConn[active].hrasconn, &RasConnStatus) == 0)
if (RasConnStatus.rasconnstate == RASCS_Connected)
{
// Figure out if this is an existing entry or a new one
DWORD dwEntrySize = sizeof(RASENTRY);
RasEntry.dwSize = sizeof(RASENTRY);
dwResult = RasGetEntryProperties(NULL, pRasEntryName[possible].szEntryName, &RasEntry,
&dwEntrySize, pDevConfig, &cbDevConfig);

if (ERROR_CANNOT_FIND_PHONEBOOK_ENTRY == dwResult)
{
free(pRasEntryName);
pRasEntryName = NULL;
free(pRasConn);
pRasConn = NULL;
return 0;//pRasEntryName[possible].szEntryName;
}
else
{
if ((_tcsstr(_T("Serial"),RasEntry.szDeviceName)==0)&&
(_tcscmp(RasEntry.szDeviceType,_T("direct"))==0))
{
//_debugTEK(_T("[GetActiveConnectionName][ActiveSync connected]:%s"),pRasEntryName[possible].szEntryName);
free(pRasEntryName);
pRasEntryName = NULL;
free(pRasConn);
pRasConn = NULL;
return 1;
}
}
}
}
}
}

}
free(pRasEntryName);
pRasEntryName = NULL;
free(pRasConn);
pRasConn = NULL;
return 0;
}

 

 

On WM5 this works to determine if connected with ActiveSync:

Read registry key:
HKLM\System\State\Hardware
Key: Cradled (1 if connected with AS)

 

From :
1. http://www.eggheadcafe.com/software/aspnet/29494492/detecting-an-activesync-c.aspx

2. http://teksoftco.com/forum/viewtopic.php?t=249

2008. 9. 5. 05:55

How do I find when active sync device has connected/disconnected- PC side

Very often there is a requirement that we should find out when an Windows Mobile device has connected with a PC.I know that I had one :-).

There are 3 ways,that I know of,using which we can achieve this objective.

1.First approach is registry based.There are two predefined events “AutoStartOnConnect” and “AutoStartOnDisconnect”. Both of these have associated registry key namely [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services\AutoStartOnConnect] and [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services\AutoStartOnDisconnect]. You add an entry here which would enable your application to be executed when these events occur. To do this you simple need to add a new string value and data would be path and name of your application and command-line if any. e.g. MyApplication - “C:\Myapplication.exe”

2. Second approach is COM based. This needs more work but you are also rewarded with more functionality :-).

Two COM interfaces are used to register an application for the notification.IDccMan and IDccManSink. Of these IDccMan is implemented by Active sync connection manager so as an application developer you just need to implement IDccMan.(Note: there is another interface IDccManSink2 which extends IDccMan and provides support for IPv6).

eg:

//Declaration

classCMyDccManSink :publicIDccManSink

{

public:

CMyDccManSink (); ~CMyDccManSink ();HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, LPVOID **ppvObject);ULONG STDMETHODCALLTYPE AddRef(); ULONG STDMETHODCALLTYPE Release();HRESULT STDMETHODCALLTYPE OnLogIpAddr(DWORD dwIpAddr);HRESULT STDMETHODCALLTYPE OnLogTerminated();HRESULT STDMETHODCALLTYPE OnLogActive();HRESULT STDMETHODCALLTYPE OnLogInactive();HRESULT STDMETHODCALLTYPE OnLogAnswered();

HRESULT STDMETHODCALLTYPE OnLogListen();

HRESULT STDMETHODCALLTYPE OnLogDisconnection();

HRESULT STDMETHODCALLTYPE OnLogError();

private:

long  lRefCount;

};

//Implementation:

CMyDccManSink::CMyDccManSink()
{
}

CMyDccManSink::~CMyDccManSink()
{
}

HRESULT STDMETHODCALLTYPE CMyDccManSink::QueryInterface(REFIID riid, void **ppvObject)
{
 if ( IID_IUnknown == riid || IID_IDccManSink == riid )
 {
  *ppvObject = (IDccManSink*)this;
  AddRef();
  return NO_ERROR;
 }
 else
 {
  *ppvObject = NULL;
  return E_NOINTERFACE;
 }
}

ULONG STDMETHODCALLTYPE CMyDccManSink::AddRef()
{
 return (ULONG)InterlockedIncrement(&lRefCount);
}

ULONG STDMETHODCALLTYPE CMyDccManSink::Release()
{
 ULONG nCount = (ULONG)InterlockedDecrement(&lRefCount);
 if ( !nCount )
 {
  delete this;
  return 0;
 }
 return nCount;
}

HRESULT STDMETHODCALLTYPE CMyDccManSink::OnLogIpAddr(DWORD dwIpAddr)
{
 //Indicates that an Internet Protocol (IP) address has
 //been established for communication between the
 //desktop computer and the target device
 return NO_ERROR;
}

HRESULT STDMETHODCALLTYPE CMyDccManSink::OnLogTerminated()
{
 //Indicates that Connection Manager has been shut down
 return NO_ERROR;
}

HRESULT STDMETHODCALLTYPE CMyDccManSink::OnLogActive()
{
 //Indicates that a connection is established between the
 //client application and Connection Manager
 return NO_ERROR;
}

HRESULT STDMETHODCALLTYPE CMyDccManSink::OnLogInactive()
{
 //Indicates a disconnection, or disconnected state,
 //between the desktop computer and the target device
 return NO_ERROR;
}

HRESULT STDMETHODCALLTYPE CMyDccManSink::OnLogAnswered()
{
 //Indicates that Connection Manager has detected
 //the communications interface
 return NO_ERROR;
}

HRESULT STDMETHODCALLTYPE CMyDccManSink::OnLogListen()
{
 //Indicates that a connection is waiting to be established
 //between the desktop computer and the target device
 return NO_ERROR;
}

HRESULT STDMETHODCALLTYPE CDevComDccSync::OnLogDisconnection()
{
 //Indicates that Connection Manager has terminated
 //the connection between the desktop computer and the target device
 return NO_ERROR;
}

HRESULT STDMETHODCALLTYPE CMyDccManSink::OnLogError()
{
 //Indicates that Connection Manager failed to start
 //communications between the desktop computer and the target device
 return NO_ERROR;
}

Now you would need to register with the connection manager:

CoInitialize(NULL);
HRESULT hResult;
IDccMan *pIDccMan = NULL;

CMyDccManSink MyDCCSink;
DWORD dwContext = 0;
hResult = CoCreateInstance(CLSID_DccMan,NULL,CLSCTX_SERVER,IID_IDccMan,(void**)&pIDccMan);

if(SUCCEEDED(hResult))

{

//Call the Advise method of IDccManSink to register for receiving the notification.

 pIDccMan->Advise(&MyDCCSink,&dwContext);

//Once you are done then you would need to call Unadvice () ,passing the context value returned in advise,to unregister for notification.

pIDccMan->Unadvise(dwContext);}3. There is a 3rd method using which you can get the Active-sync connect and disconnet events.Whenever any hardware device is connected on Desktop PC an event is fired to all the applications that have registered for the event.You can leverage this to get the notification. The function that you can use for this is RegisterDeviceNotification(). This functions registers the device/device type for which w windows will receive the notification.//sample code:GUID_DEVINTERFACE_USB_DEVICE={ 0xA5DCBF10, 0×6530, 0×11D2, { 0×90, 0×1F, 0×00, 0xC0, 0×4F, 0xB9, 0×51, 0xED } },

DEV_BROADCAST_DEVICEINTERFACE NotificationFilter;

ZeroMemory( &NotificationFilter, sizeof(NotificationFilter) );
NotificationFilter.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
NotificationFilter.dbcc_classguid = GUID_DEVINTERFACE_USB_DEVICE;

//First parameter is a handle to your applications window

HANDLE  hDevNotify = RegisterDeviceNotification(hWnd,&NotificationFilter,
DEVICE_NOTIFY_WINDOW_HANDLE);

If the registration is successfull then return value is device handle and if it fails then it returns NULL. System sends WM_DEVICECHANGE notification to your window,you can handle this in your Wnd proc.

//WndProc

case WM_DEVICECHANGE:

if(wParam==DBT_DEVICEARRIVAL

{

//Device has been added

//You can find if it was active sync device by using SetUpDi set of functions and lParam.lParam contains the Dev Broad cast header.

//

}

else if(wParam==DBT_DEVICEREMOVECOMPLETE)

{

//Device has been removed  

//You can find if it was active sync device by using SetUpDi set of functions and lParam.lParam contains the Dev Broad cast header.

})//End of WndProcWhen you no longer need the notification then you must Unregister for the notification using UnRegisterDeviceNotification().UnRegisterDeviceNotification(hDevNotify )

출처 : http://amitranjan.wordpress.com/2007/04/23/how-do-i-find-when-active-sync-has-startedstopped-pc-side/

2008. 9. 2. 14:53

Visual Studio .NET 2005 에서 에뮬레이터와 PC간에 연결 문제 해결

Visual Studio .NET 2005에서 Pocket PC 2003 (또는 Smartphone) 에서 운영되는 Agent 프로그램을 개발.

TCP를 이용하여 에뮬레이터와 PC 어플리케이션간 통신을 해야 하는데 여기서 연결이 되지 않고,

WSAGetLastError()에서 10065 를 반환하기만 했다.

TCP 연결을 뚫기 위해서 Microsoft Loopback Adaptor도 설치하여 보았으나 이건 용도가 틀린것 같다.

아래 참고 링크를 보면 MLA 는 "네트워크 연결 없이 장치 에뮬레이터에 연결"하는 방법인 것 같다.

어쨋든 TCP 연결을 뚫기 위해서 다음은 에뮬레이터와 PC간에 ActiveSync 연결을 이용해 보기로 했다. ActiveSync가 연결되어 있으면 TCP를 사용할 수 있기 때문에 이 방법을 시도하였다.

ActiveSync 연결을 수립하기 위해서는 다음의 절차를 밟아야 한다. (.NET 2005의 경우)

1. Visual Studio .NET 2005 > Tools (도구) 메뉴 > Device Emulator Manager (장치 에뮬레이터 관리자) 시작

사용자 삽입 이미지


2. 원하는 에뮬레이터에 연결

3. 선택한 에뮬레이터의 상태를 Cradle 로 변경
   Device Emulator Manager > Actiosn > Cradle

사용자 삽입 이미지

4. 만약 자동 연결이 되지 않는 경우 ActiveSync 대화상자 오픈 "파일 > 연결 시작" 실행 후 장치 연결 시도

사용자 삽입 이미지


5. ActiveSync가 연결되면 정상적으로 TCP 연결이 동작

이것때문에 삽질좀 했네..끙.

참고 :

http://msdn.microsoft.com/ko-kr/library/aa188183.aspx




2008. 8. 31. 01:25

WAP & WML

l  WAP

현재의 이동 통신망에서 인터넷 서비스를 제공할 수 있도록 하기 위하여 Unwired Planet()( Phone.com )에서는 HDTP(Handheld Device Transport Protocol)HTML(Handheld Device Markup Language)을 개발하고, Nokia 사에서는 TTML(Tagged Text Mark-up Language)를 개발하였다. 또한 Ericsson 사에서는 ITTP(Intelligent Terminal Transfer Protocol)를 개발하였다. 이에 따라 업체마다 각기 나름의 기술을 개발하게 되어 서로 호환되지 않는 문제가 발생하였다.

 

이에 1997 6월에 Ericsson, Motorola, Nokia, Unwired Planet 4개사가 공통 규격을 제정하기로 하고 WAP(Wireless Application Protocol) 포럼을 결성하였고, 현재 전세계 100여여 개 넘는 업체가 참여하고 있다.

 

WAP의 목적은 디지털 셀룰러 전화(PCS )와 무선 터미널에서 인터넷 서비스를 이용할 수 있도록 하고, 다른 종류의 무선 통신망 기술에서 운용될 수 있는 무선 프로토콜 규격을 개발하고, 다른 종류의 무선 통신망 기술과 장비들에도 쓰일 수 있는 컨텐츠와 응용기술을 개발하는 것이다.

 

l  WML

WML(Wireless Markup Language)은 세계 100여개 업체가 참가한 WAP 포럼에서 무선전화기, 페이저 그리고 PDA와 같은 이동단말기상에서의 입력과 표시를 목적으로 XML(eXtensible Markup Language)에 기반을 두고 개발된 markup 언어이다.

 

WML 언어는 작은 화면과 제한된 메모리, CPU, 낮은 대역폭(bandwidth), 긴 접속대기 시간을 가지고 있는 이동 단말기에 적합한 언어로써, 이 이동단말기는 두가지 범주로 나눌 수가 있다.

 

1.     보통 4~10줄 정도를 한 화면에서 볼 수 있도록 지원하면 숫자키와 특수키를 이용해 사용자의 효율적인 입력을 지원

 

2.     100 X 100 픽셀 정도의 해상도와 키패드와 포인터, 필기 인식 등을 통해 무선전화기보다는 더 자유로운 사용자 입력을 지원

 

출처 : e-Campus 강좌 중에서