source: trunk/kProfiler2/kPrf2WinApiWrappers.c@ 76

Last change on this file since 76 was 29, checked in by bird, 16 years ago

Finally got around execute the switch to the MIT license.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.5 KB
RevLine 
[11]1/* $Id: kPrf2WinApiWrappers.c 29 2009-07-01 20:30:29Z bird $ */
2/** @file
3 * Wrappers for a number of common Windows APIs.
4 */
5
6/*
[29]7 * Copyright (c) 2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net>
[11]8 *
[29]9 * Permission is hereby granted, free of charge, to any person
10 * obtaining a copy of this software and associated documentation
11 * files (the "Software"), to deal in the Software without
12 * restriction, including without limitation the rights to use,
13 * copy, modify, merge, publish, distribute, sublicense, and/or sell
14 * copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following
16 * conditions:
[11]17 *
[29]18 * The above copyright notice and this permission notice shall be
19 * included in all copies or substantial portions of the Software.
[11]20 *
[29]21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
23 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28 * OTHER DEALINGS IN THE SOFTWARE.
[11]29 */
30
31/*******************************************************************************
32* Header Files *
33*******************************************************************************/
34#define _ADVAPI32_
35#define _KERNEL32_
36#define _WIN32_WINNT 0x0600
37#define UNICODE
38#include <Windows.h>
39#include <TLHelp32.h>
[12]40#include <k/kDefs.h>
[13]41#include "kPrf2WinApiWrapperHlp.h"
[11]42
[12]43#if K_ARCH == K_ARCH_X86_32
44typedef PVOID PRUNTIME_FUNCTION;
45typedef FARPROC PGET_RUNTIME_FUNCTION_CALLBACK;
46#endif
[11]47
[13]48/* RtlUnwindEx is used by msvcrt on amd64, but winnt.h only defines it for IA64... */
49typedef struct _FRAME_POINTERS {
50 ULONGLONG MemoryStackFp;
51 ULONGLONG BackingStoreFp;
52} FRAME_POINTERS, *PFRAME_POINTERS;
53typedef PVOID PUNWIND_HISTORY_TABLE;
54typedef PVOID PKNONVOLATILE_CONTEXT_POINTERS;
55
56
[11]57/*******************************************************************************
[13]58* Global Variables *
[11]59*******************************************************************************/
[13]60KPRF2WRAPDLL g_Kernel32 =
[11]61{
[13]62 INVALID_HANDLE_VALUE, "KERNEL32"
63};
[11]64
[12]65
[13]66/*
67 * Include the generated code.
68 */
69#include "kPrf2WinApiWrappers-kernel32.h"
70
[11]71/* TODO (amd64):
72
73AddLocalAlternateComputerNameA
74AddLocalAlternateComputerNameW
75EnumerateLocalComputerNamesA
76EnumerateLocalComputerNamesW
77RemoveLocalAlternateComputerNameA
78RemoveLocalAlternateComputerNameW
79
80RtlLookupFunctionEntry
81RtlPcToFileHeader
82RtlRaiseException
83RtlVirtualUnwind
84
85SetConsoleCursor
86SetLocalPrimaryComputerNameA
87SetLocalPrimaryComputerNameW
88__C_specific_handler
89__misaligned_access
90_local_unwind
[13]91
[11]92*/
93
[13]94
95/**
96 * The DLL Main for the Windows API wrapper DLL.
97 *
98 * @returns Success indicator.
99 * @param hInstDll The instance handle of the DLL. (i.e. the module handle)
100 * @param fdwReason The reason why we're here. This is a 'flag' for reasons of
101 * tradition, it's really a kind of enum.
102 * @param pReserved Reserved / undocumented something.
103 */
104BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, PVOID pReserved)
[11]105{
[13]106 switch (fdwReason)
107 {
108 case DLL_PROCESS_ATTACH:
109 break;
[11]110
[13]111 case DLL_PROCESS_DETACH:
112 break;
[11]113
[13]114 case DLL_THREAD_ATTACH:
115 break;
[11]116
[13]117 case DLL_THREAD_DETACH:
118 break;
[11]119 }
120
[13]121 return TRUE;
[11]122}
123
Note: See TracBrowser for help on using the repository browser.