Debug a Windows CE setup DLL

0.00 avg. rating (0% score) - 0 votes

::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

    0.00 avg. rating (0% score) - 0 votes
    ToughDev

    ToughDev

    A tough developer who likes to work on just about anything, from software development to electronics, and share his knowledge with the rest of the world.

    Leave a Reply