Changeset 13 for trunk/kProfiler2/kPrf2WinApiWrappers.c
- Timestamp:
- Apr 20, 2008, 12:13:43 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kProfiler2/kPrf2WinApiWrappers.c
r12 r13 33 33 #include <TLHelp32.h> 34 34 #include <k/kDefs.h> 35 #include "kPrf2WinApiWrapperHlp.h" 35 36 36 37 #if K_ARCH == K_ARCH_X86_32 … … 39 40 #endif 40 41 42 /* RtlUnwindEx is used by msvcrt on amd64, but winnt.h only defines it for IA64... */ 43 typedef struct _FRAME_POINTERS { 44 ULONGLONG MemoryStackFp; 45 ULONGLONG BackingStoreFp; 46 } FRAME_POINTERS, *PFRAME_POINTERS; 47 typedef PVOID PUNWIND_HISTORY_TABLE; 48 typedef PVOID PKNONVOLATILE_CONTEXT_POINTERS; 49 50 41 51 /******************************************************************************* 42 * Structures and Typedefs*52 * Global Variables * 43 53 *******************************************************************************/ 44 typedef struct KPRF2WRAPDLL 54 KPRF2WRAPDLL g_Kernel32 = 45 55 { 46 HMODULE hmod; 47 char szName[32]; 48 } KPRF2WRAPDLL; 49 typedef KPRF2WRAPDLL *PKPRF2WRAPDLL; 50 typedef KPRF2WRAPDLL const *PCKPRF2WRAPDLL; 56 INVALID_HANDLE_VALUE, "KERNEL32" 57 }; 51 58 59 60 /* 61 * Include the generated code. 62 */ 63 #include "kPrf2WinApiWrappers-kernel32.h" 52 64 53 65 /* TODO (amd64): … … 71 83 __misaligned_access 72 84 _local_unwind 85 73 86 */ 74 87 75 /******************************************************************************* 76 * Global Variables * 77 *******************************************************************************/ 78 KPRF2WRAPDLL g_Kernel32 = 88 89 /** 90 * The DLL Main for the Windows API wrapper DLL. 91 * 92 * @returns Success indicator. 93 * @param hInstDll The instance handle of the DLL. (i.e. the module handle) 94 * @param fdwReason The reason why we're here. This is a 'flag' for reasons of 95 * tradition, it's really a kind of enum. 96 * @param pReserved Reserved / undocumented something. 97 */ 98 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, PVOID pReserved) 79 99 { 80 INVALID_HANDLE_VALUE, "KERNEL32" 81 }; 100 switch (fdwReason) 101 { 102 case DLL_PROCESS_ATTACH: 103 break; 82 104 105 case DLL_PROCESS_DETACH: 106 break; 83 107 84 /******************************************************************************* 85 * Internal Functions * 86 *******************************************************************************/ 87 FARPROC kPrf2WrapResolve(void **ppfn, const char *pszName, PKPRF2WRAPDLL pDll); 108 case DLL_THREAD_ATTACH: 109 break; 88 110 89 90 FARPROC kPrf2WrapResolve(void **ppfn, const char *pszName, PKPRF2WRAPDLL pDll) 91 { 92 FARPROC pfn; 93 HMODULE hmod = pDll->hmod; 94 if (hmod == INVALID_HANDLE_VALUE) 95 { 96 hmod = LoadLibraryA(pDll->szName); 97 pDll->hmod = hmod; 111 case DLL_THREAD_DETACH: 112 break; 98 113 } 99 114 100 pfn = GetProcAddress(hmod, pszName); 101 *ppfn = (void *)pfn; 102 return pfn; 115 return TRUE; 103 116 } 104 117 105 106 #include "kPrf2WinApiWrappers-kernel32.h"
Note:
See TracChangeset
for help on using the changeset viewer.