Click here to Skip to main content
15,888,351 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to convert MultiByte local code to Unicode? Pin
Hamid_RT17-Apr-08 19:18
Hamid_RT17-Apr-08 19:18 
GeneralAudio Signal Processing using Directshow(ISampleGrabber) - 2 Pin
Akin Ocal16-Apr-08 15:01
Akin Ocal16-Apr-08 15:01 
GeneralChanging Parameters of a DMO which added as filter in Directshow Pin
Akin Ocal16-Apr-08 14:50
Akin Ocal16-Apr-08 14:50 
GeneralLoadLibrary in a DLL Pin
ForNow16-Apr-08 14:41
ForNow16-Apr-08 14:41 
GeneralRe: LoadLibrary in a DLL Pin
Stephen Hewitt16-Apr-08 15:03
Stephen Hewitt16-Apr-08 15:03 
GeneralRe: LoadLibrary in a DLL Pin
ForNow16-Apr-08 16:45
ForNow16-Apr-08 16:45 
GeneralRe: LoadLibrary in a DLL Pin
Randor 16-Apr-08 16:50
professional Randor 16-Apr-08 16:50 
GeneralRe: LoadLibrary in a DLL Pin
ForNow16-Apr-08 17:09
ForNow16-Apr-08 17:09 
Okay

The function is init_image at the bottom

I call it from my main() exe

This all started when I wanted to see what thread('s) came in on the THREAD_ATTACH so decided to play around with StacKwalk in imagehlp.dll etc.....



BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)


{



switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
i = 4;
break;

case DLL_PROCESS_DETACH:
i = 3;
break;

case DLL_THREAD_ATTACH:



threadhndl = 0;
DuplicateHandle( GetCurrentProcess(), // Source Process Handle.
GetCurrentThread(), // Source Handle to dup.
GetCurrentProcess(), // Target Process Handle.
&threadhndl, // Target Handle pointer.
0, // Options flag.
TRUE, // Inheritable flag
DUPLICATE_SAME_ACCESS );// Options

processhndl = 0;
DuplicateHandle( GetCurrentProcess(), // Source Process Handle.
GetCurrentProcess(), // Source Handle to dup.
GetCurrentProcess(), // Target Process Handle.
&processhndl, // Target Handle pointer.
0, // Options flag.
TRUE, // Inheritable flag
DUPLICATE_SAME_ACCESS );// Options

memset( &c, '\0', sizeof c );
c.ContextFlags = CONTEXT_FULL;
GetThreadContext(threadhndl, &c);
s.AddrPC.Offset = c.Eip;
s.AddrPC.Mode = AddrModeFlat;
s.AddrFrame.Offset = c.Ebp;
s.AddrFrame.Mode = AddrModeFlat;


while(1)
pSW(imageType, processhndl, threadhndl, &s, &c, NULL, NULL, NULL, NULL );



// while(1)
// StackWalk(IMAGE_FILE_MACHINE_I386,
// processhndl,
// threadhndl,
// &s,
// &c,NULL,NULL,NULL,NULL);
break;
case DLL_THREAD_DETACH:
i = 2;
break;
return false;
}
return TRUE;
}


__declspec(dllexport) void init_image(void)
{

imageType = IMAGE_FILE_MACHINE_I386;
pSW = NULL;
hImagehlpDll = NULL;
hImagehlpDll = LoadLibrary((LPCWSTR) "imagehlp.dll" );
pSW = (tSW) GetProcAddress( hImagehlpDll, "StackWalk" );
return;
}


Thankx
GeneralRe: LoadLibrary in a DLL Pin
Randor 16-Apr-08 17:25
professional Randor 16-Apr-08 17:25 
GeneralRe: LoadLibrary in a DLL Pin
ForNow16-Apr-08 17:39
ForNow16-Apr-08 17:39 
GeneralRe: LoadLibrary in a DLL Pin
Randor 16-Apr-08 17:49
professional Randor 16-Apr-08 17:49 
GeneralRe: LoadLibrary in a DLL Pin
ForNow17-Apr-08 16:12
ForNow17-Apr-08 16:12 
QuestionRe: LoadLibrary in a DLL Pin
David Crow17-Apr-08 4:10
David Crow17-Apr-08 4:10 
QuestionRe: LoadLibrary in a DLL Pin
David Crow17-Apr-08 4:10
David Crow17-Apr-08 4:10 
GeneralRe: LoadLibrary in a DLL Pin
ForNow17-Apr-08 6:47
ForNow17-Apr-08 6:47 
GeneralRe: LoadLibrary in a DLL The value returned from LoadLibrary was NULL Pin
ForNow17-Apr-08 6:56
ForNow17-Apr-08 6:56 
QuestionRe: LoadLibrary in a DLL The value returned from LoadLibrary was NULL Pin
David Crow17-Apr-08 7:29
David Crow17-Apr-08 7:29 
GeneralRe: LoadLibrary in a DLL The value returned from LoadLibrary was NULL Pin
ForNow17-Apr-08 14:47
ForNow17-Apr-08 14:47 
GeneralhImagehlpDll = LoadLibrary((LPCWSTR)L"imagehlp.dll" ); this WORKED Pin
ForNow17-Apr-08 16:16
ForNow17-Apr-08 16:16 
GeneralRe: hImagehlpDll = LoadLibrary((LPCWSTR)L"imagehlp.dll" ); this WORKED Pin
David Crow18-Apr-08 3:34
David Crow18-Apr-08 3:34 
GeneralRe: hImagehlpDll = LoadLibrary((LPCWSTR)L"imagehlp.dll" ); this WORKED Pin
ForNow18-Apr-08 6:21
ForNow18-Apr-08 6:21 
QuestionRe: hImagehlpDll = LoadLibrary((LPCWSTR)L"imagehlp.dll" ); this WORKED Pin
David Crow18-Apr-08 7:02
David Crow18-Apr-08 7:02 
GeneralRe: hImagehlpDll = LoadLibrary((LPCWSTR)L"imagehlp.dll" ); this WORKED Pin
ForNow18-Apr-08 11:42
ForNow18-Apr-08 11:42 
Generalinline Pin
User 58385216-Apr-08 13:12
User 58385216-Apr-08 13:12 
GeneralRe: inline Pin
Stephen Hewitt16-Apr-08 15:10
Stephen Hewitt16-Apr-08 15:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.