Code Repo    |     RSS
MD's Technical Sharing



Friday, February 13, 2009

Debug a Windows CE setup DLL

::GetModuleFileName(g_hInstDLL, szName, nSize);
::
MessageBox(hwndParent, szName, _T(""), MB_OK);


where g_hInstDLL is the handle to the loaded module, usually available in the DLL entry point:


BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
//assign the handle here
g_hInstDLL
= (HINSTANCE)hModule;
break;
}
return TRUE;
}


  • Change the setup DLL project properties-> Configuration Properties->Linker -> General -> Output File. Change the existing value to $(OutDir)/STPXXXX.dll where STXXXX.dll is the filename found in step 3 and rebuild the DLL.
  • Go to Tools -> Attach To Process, select device or emulator and attach to process tmarshaller.exe
  • Breakpoint should now be hit and debugging can be done.
  • After debugging, remember to change the linker output file name back to how it was (e.g. $(OutDir)/Setup.dll )

    Reference:

    http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesnative/thread/03b20581-1479-44aa-ba9d-caf1c313c4eb

    No comments:

    Post a Comment

    Note: Only a member of this blog may post a comment.