source: trunk/kProfiler2/kPrf2WinApiWrappers.c@ 12

Last change on this file since 12 was 12, checked in by bird, 17 years ago

Generated the x86 def file.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.2 KB
Line 
1/* $Id: kPrf2WinApiWrappers.c 12 2008-04-20 09:26:06Z bird $ */
2/** @file
3 * Wrappers for a number of common Windows APIs.
4 */
5
6/*
7 * Copyright (c) 2008 knut st. osmundsen <bird-src-spam@anduin.net>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with This program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 *
23 */
24
25/*******************************************************************************
26* Header Files *
27*******************************************************************************/
28#define _ADVAPI32_
29#define _KERNEL32_
30#define _WIN32_WINNT 0x0600
31#define UNICODE
32#include <Windows.h>
33#include <TLHelp32.h>
34#include <k/kDefs.h>
35
36#if K_ARCH == K_ARCH_X86_32
37typedef PVOID PRUNTIME_FUNCTION;
38typedef FARPROC PGET_RUNTIME_FUNCTION_CALLBACK;
39#endif
40
41/*******************************************************************************
42* Structures and Typedefs *
43*******************************************************************************/
44typedef struct KPRF2WRAPDLL
45{
46 HMODULE hmod;
47 char szName[32];
48} KPRF2WRAPDLL;
49typedef KPRF2WRAPDLL *PKPRF2WRAPDLL;
50typedef KPRF2WRAPDLL const *PCKPRF2WRAPDLL;
51
52
53/* TODO (amd64):
54
55AddLocalAlternateComputerNameA
56AddLocalAlternateComputerNameW
57EnumerateLocalComputerNamesA
58EnumerateLocalComputerNamesW
59RemoveLocalAlternateComputerNameA
60RemoveLocalAlternateComputerNameW
61
62RtlLookupFunctionEntry
63RtlPcToFileHeader
64RtlRaiseException
65RtlVirtualUnwind
66
67SetConsoleCursor
68SetLocalPrimaryComputerNameA
69SetLocalPrimaryComputerNameW
70__C_specific_handler
71__misaligned_access
72_local_unwind
73*/
74
75/*******************************************************************************
76* Global Variables *
77*******************************************************************************/
78KPRF2WRAPDLL g_Kernel32 =
79{
80 INVALID_HANDLE_VALUE, "KERNEL32"
81};
82
83
84/*******************************************************************************
85* Internal Functions *
86*******************************************************************************/
87FARPROC kPrf2WrapResolve(void **ppfn, const char *pszName, PKPRF2WRAPDLL pDll);
88
89
90FARPROC 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;
98 }
99
100 pfn = GetProcAddress(hmod, pszName);
101 *ppfn = (void *)pfn;
102 return pfn;
103}
104
105
106#include "kPrf2WinApiWrappers-kernel32.h"
Note: See TracBrowser for help on using the repository browser.