|
// NativeDLL.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#include "NativeDLL.h"
#include <stdio.h>
#include <objbase.h>
#include "..\\stackdumper.h"
#ifdef _MANAGED
#pragma managed(push, off)
#endif
BOOL APIENTRY DllMain( HMODULE 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:
break;
}
return TRUE;
}
#ifdef _MANAGED
#pragma managed(pop)
#endif
NATIVEDLL_API const char* NativeDllCall(int arg)
{
const char *szc = GetCallingModulePath(arg);
return szc;
}
NATIVEDLL_API int GetModuleStackTraceFromNative(char**& pList)
{
return GetModuleStackTrace(pList);
}
NATIVEDLL_API int TestTrace()
{
printf("\nstack trace---------\n");
char** pszc = NULL, **original = NULL;
int cnt = GetModuleStackTraceFromNative(pszc);
original = pszc;
printf("\nstack trace completed---------\n");
while(cnt-- > 0)
{
printf("Trace: = %s\n", *pszc);
CoTaskMemFree(*pszc);
pszc++;
}
CoTaskMemFree(original);
return cnt;
return 0;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I received my Bachelors from the University of Georgia in 1989 and have been a Windows programmer ever since. I have worked with encryption algorithms, online payment systems, Windows Development, MSSQL 4 and above, VB 4 and above. I received my .Net Certification in 2005 and currently work as a Software Developer in a .Net House (mainly VB.Net, but I also do some C# on the side). I run a small Web & Software Development company from my home and (as stated) work full-time as a .Net programmer.
Update: I am now Senior Application Developer for a small upstart company. I develop solely in C# utilizing MSSQL