ReactOS  0.4.13-dev-455-g28ed234
createspec.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <dbghelp.h>
Include dependency graph for createspec.c:

Go to the source code of this file.

Classes

struct  _EXPORT
 
struct  _EXPORT_DATA
 

Macros

#define MINGW_HAS_SECURE_API
 
#define _NO_CVCONST_H
 
#define MAX_PARAMETERS   64
 

Typedefs

typedef enum CV_call_e CV_call_e
 
typedef enum _PARAM_TYPES PARAM_TYPES
 
typedef enum _PARAM_TYPESPPARAM_TYPES
 
typedef struct _EXPORT EXPORT
 
typedef struct _EXPORTPEXPORT
 
typedef struct _EXPORT_DATA EXPORT_DATA
 
typedef struct _EXPORT_DATAPEXPORT_DATA
 

Enumerations

enum  BasicType {
  btNoType = 0, btVoid = 1, btChar = 2, btWChar = 3,
  btInt = 6, btUInt = 7, btFloat = 8, btBCD = 9,
  btBool = 10, btLong = 13, btULong = 14, btCurrency = 25,
  btDate = 26, btVariant = 27, btComplex = 28, btBit = 29,
  btBSTR = 30, btHresult = 31, btNoType = 0, btVoid = 1,
  btChar = 2, btWChar = 3, btInt = 6, btUInt = 7,
  btFloat = 8, btBCD = 9, btBool = 10, btLong = 13,
  btULong = 14, btCurrency = 25, btDate = 26, btVariant = 27,
  btComplex = 28, btBit = 29, btBSTR = 30, btHresult = 31,
  btNoType = 0, btVoid = 1, btChar = 2, btWChar = 3,
  btInt = 6, btUInt = 7, btFloat = 8, btBCD = 9,
  btBool = 10, btLong = 13, btULong = 14, btCurrency = 25,
  btDate = 26, btVariant = 27, btComplex = 28, btBit = 29,
  btBSTR = 30, btHresult = 31, btNoType = 0, btVoid = 1,
  btChar = 2, btWChar = 3, btInt = 6, btUInt = 7,
  btFloat = 8, btBCD = 9, btBool = 10, btLong = 13,
  btULong = 14, btCurrency = 25, btDate = 26, btVariant = 27,
  btComplex = 28, btBit = 29, btBSTR = 30, btHresult = 31,
  btChar16 = 32, btChar32 = 33
}
 
enum  CV_call_e {
  CV_CALL_NEAR_C, CV_CALL_FAR_C, CV_CALL_NEAR_PASCAL, CV_CALL_FAR_PASCAL,
  CV_CALL_NEAR_FAST, CV_CALL_FAR_FAST, CV_CALL_SKIPPED, CV_CALL_NEAR_STD,
  CV_CALL_FAR_STD, CV_CALL_NEAR_SYS, CV_CALL_FAR_SYS, CV_CALL_THISCALL,
  CV_CALL_MIPSCALL, CV_CALL_GENERIC, CV_CALL_ALPHACALL, CV_CALL_PPCCALL,
  CV_CALL_SHCALL, CV_CALL_ARMCALL, CV_CALL_AM33CALL, CV_CALL_TRICALL,
  CV_CALL_SH5CALL, CV_CALL_M32RCALL, CV_CALL_RESERVED, CV_CALL_NEAR_C = 0x00,
  CV_CALL_NEAR_FAST = 0x04, CV_CALL_NEAR_STD = 0x07, CV_CALL_NEAR_SYS = 0x09, CV_CALL_THISCALL = 0x0b,
  CV_CALL_CLRCALL = 0x16, CV_CALL_NEAR_C, CV_CALL_FAR_C, CV_CALL_NEAR_PASCAL,
  CV_CALL_FAR_PASCAL, CV_CALL_NEAR_FAST, CV_CALL_FAR_FAST, CV_CALL_SKIPPED,
  CV_CALL_NEAR_STD, CV_CALL_FAR_STD, CV_CALL_NEAR_SYS, CV_CALL_FAR_SYS,
  CV_CALL_THISCALL, CV_CALL_MIPSCALL, CV_CALL_GENERIC, CV_CALL_ALPHACALL,
  CV_CALL_PPCCALL, CV_CALL_SHCALL, CV_CALL_ARMCALL, CV_CALL_AM33CALL,
  CV_CALL_TRICALL, CV_CALL_SH5CALL, CV_CALL_M32RCALL, CV_CALL_RESERVED
}
 
enum  _PARAM_TYPES {
  TYPE_NONE, TYPE_LONG, TYPE_DOUBLE, TYPE_PTR,
  TYPE_STR, TYPE_WSTR
}
 

Functions

void error (_In_ const char *pszFormat,...)
 
BOOL InitDbgHelp (VOID)
 
HMODULE LoadModuleWithSymbolsFullPath (_In_ PSTR pszFullModuleFileName)
 
HMODULE LoadModuleWithSymbols (_In_ PSTR pszModuleName)
 
HRESULT GetExportsFromFile (_In_ HMODULE hmod, _Out_ PEXPORT_DATA *ppExportData)
 
BOOL CALLBACK EnumParametersCallback (_In_ PSYMBOL_INFO pSymInfo, _In_ ULONG SymbolSize, _In_ PVOID UserContext)
 
ULONG64 GetFunctionFromForwarder (_In_ PCSTR pszForwarder)
 
HRESULT ParseImageSymbols (_In_ HMODULE hmod, _Inout_ PEXPORT_DATA pExportData)
 
const CHARGetCallingConvention (_In_ PEXPORT pExport)
 
HRESULT CreateSpecFile (_In_ PCSTR pszSpecFile, _In_ PEXPORT_DATA pExportData)
 
int main (int argc, char *argv[])
 

Variables

const chargapszTypeStrings []
 
HANDLE ghProcess
 

Macro Definition Documentation

◆ _NO_CVCONST_H

#define _NO_CVCONST_H

Definition at line 31 of file createspec.c.

◆ MAX_PARAMETERS

#define MAX_PARAMETERS   64

Definition at line 89 of file createspec.c.

◆ MINGW_HAS_SECURE_API

#define MINGW_HAS_SECURE_API

Definition at line 11 of file createspec.c.

Typedef Documentation

◆ CV_call_e

◆ EXPORT

◆ EXPORT_DATA

◆ PARAM_TYPES

◆ PEXPORT

typedef struct _EXPORT * PEXPORT

◆ PEXPORT_DATA

◆ PPARAM_TYPES

Enumeration Type Documentation

◆ _PARAM_TYPES

Enumerator
TYPE_NONE 
TYPE_LONG 
TYPE_DOUBLE 
TYPE_PTR 
TYPE_STR 
TYPE_WSTR 

Definition at line 68 of file createspec.c.

69 {
70  TYPE_NONE,
71  TYPE_LONG,
73  TYPE_PTR,
74  TYPE_STR,
75  TYPE_WSTR
enum _PARAM_TYPES * PPARAM_TYPES
enum _PARAM_TYPES PARAM_TYPES

◆ BasicType

Enumerator
btNoType 
btVoid 
btChar 
btWChar 
btInt 
btUInt 
btFloat 
btBCD 
btBool 
btLong 
btULong 
btCurrency 
btDate 
btVariant 
btComplex 
btBit 
btBSTR 
btHresult 
btNoType 
btVoid 
btChar 
btWChar 
btInt 
btUInt 
btFloat 
btBCD 
btBool 
btLong 
btULong 
btCurrency 
btDate 
btVariant 
btComplex 
btBit 
btBSTR 
btHresult 
btNoType 
btVoid 
btChar 
btWChar 
btInt 
btUInt 
btFloat 
btBCD 
btBool 
btLong 
btULong 
btCurrency 
btDate 
btVariant 
btComplex 
btBit 
btBSTR 
btHresult 
btNoType 
btVoid 
btChar 
btWChar 
btInt 
btUInt 
btFloat 
btBCD 
btBool 
btLong 
btULong 
btCurrency 
btDate 
btVariant 
btComplex 
btBit 
btBSTR 
btHresult 
btChar16 
btChar32 

Definition at line 35 of file createspec.c.

35  {
36  btNoType = 0,
37  btVoid = 1,
38  btChar = 2,
39  btWChar = 3,
40  btInt = 6,
41  btUInt = 7,
42  btFloat = 8,
43  btBCD = 9,
44  btBool = 10,
45  btLong = 13,
46  btULong = 14,
47  btCurrency = 25,
48  btDate = 26,
49  btVariant = 27,
50  btComplex = 28,
51  btBit = 29,
52  btBSTR = 30,
53  btHresult = 31
54 };

◆ CV_call_e

Enumerator
CV_CALL_NEAR_C 
CV_CALL_FAR_C 
CV_CALL_NEAR_PASCAL 
CV_CALL_FAR_PASCAL 
CV_CALL_NEAR_FAST 
CV_CALL_FAR_FAST 
CV_CALL_SKIPPED 
CV_CALL_NEAR_STD 
CV_CALL_FAR_STD 
CV_CALL_NEAR_SYS 
CV_CALL_FAR_SYS 
CV_CALL_THISCALL 
CV_CALL_MIPSCALL 
CV_CALL_GENERIC 
CV_CALL_ALPHACALL 
CV_CALL_PPCCALL 
CV_CALL_SHCALL 
CV_CALL_ARMCALL 
CV_CALL_AM33CALL 
CV_CALL_TRICALL 
CV_CALL_SH5CALL 
CV_CALL_M32RCALL 
CV_CALL_RESERVED 
CV_CALL_NEAR_C 
CV_CALL_NEAR_FAST 
CV_CALL_NEAR_STD 
CV_CALL_NEAR_SYS 
CV_CALL_THISCALL 
CV_CALL_CLRCALL 
CV_CALL_NEAR_C 
CV_CALL_FAR_C 
CV_CALL_NEAR_PASCAL 
CV_CALL_FAR_PASCAL 
CV_CALL_NEAR_FAST 
CV_CALL_FAR_FAST 
CV_CALL_SKIPPED 
CV_CALL_NEAR_STD 
CV_CALL_FAR_STD 
CV_CALL_NEAR_SYS 
CV_CALL_FAR_SYS 
CV_CALL_THISCALL 
CV_CALL_MIPSCALL 
CV_CALL_GENERIC 
CV_CALL_ALPHACALL 
CV_CALL_PPCCALL 
CV_CALL_SHCALL 
CV_CALL_ARMCALL 
CV_CALL_AM33CALL 
CV_CALL_TRICALL 
CV_CALL_SH5CALL 
CV_CALL_M32RCALL 
CV_CALL_RESERVED 

Definition at line 56 of file createspec.c.

Function Documentation

◆ CreateSpecFile()

HRESULT CreateSpecFile ( _In_ PCSTR  pszSpecFile,
_In_ PEXPORT_DATA  pExportData 
)

Definition at line 665 of file createspec.c.

668 {
669  FILE *file;
670  ULONG i, p;
671  PEXPORT pExport;
672 
673  /* Create the spec file */
674  if (fopen_s(&file, pszSpecFile, "w") != 0)
675  {
676  error("Failed to open spec file: '%s'\n", pszSpecFile);
677  return E_FAIL;
678  }
679 
680  /* Loop all exports */
681  for (i = 0; i < pExportData->cNumberOfExports; i++)
682  {
683  pExport = &pExportData->aExports[i];
684 
685  fprintf(file, "%lu %s ", i + 1, GetCallingConvention(pExport));
686  //if (pExport->fNoName)
687  if (pExport->pszName == NULL)
688  {
689  fprintf(file, "-noname ");
690  }
691 
692  if (pExport->pszName != NULL)
693  {
694  fprintf(file, "%s", pExport->pszName);
695  }
696  else if (pExport->pszSymbol != NULL)
697  {
698  fprintf(file, "%s", pExport->pszSymbol);
699  }
700  else
701  {
702  fprintf(file, "NamelessExport_%lu", i);
703  }
704 
705  if (!pExport->fData)
706  {
707  fprintf(file, "(");
708  for (p = 0; p < pExport->cParameters; p++)
709  {
710  fprintf(file, "%s", gapszTypeStrings[pExport->aeParameters[p]]);
711  if ((p + 1) < pExport->cParameters)
712  {
713  fprintf(file, " ");
714  }
715  }
716  fprintf(file, ")");
717  }
718 
719  if (pExport->pszForwarder != NULL)
720  {
721  fprintf(file, " %s", pExport->pszForwarder);
722  }
723 
724  fprintf(file, "\n");
725  }
726 
727  fclose(file);
728 
729  return S_OK;
730 }
#define E_FAIL
Definition: ddrawi.h:102
ULONG fData
Definition: createspec.c:99
int CDECL fopen_s(FILE **pFile, const char *filename, const char *mode)
Definition: file.c:3255
PSTR pszName
Definition: createspec.c:92
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
const char * gapszTypeStrings[]
Definition: createspec.c:79
ULONG cParameters
Definition: createspec.c:100
smooth NULL
Definition: ftsmooth.c:416
void error(_In_ const char *pszFormat,...)
Definition: createspec.c:113
const char file[]
Definition: icontest.c:11
PSTR pszSymbol
Definition: createspec.c:93
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
const CHAR * GetCallingConvention(_In_ PEXPORT pExport)
Definition: createspec.c:636
#define S_OK
Definition: intsafe.h:59
unsigned int ULONG
Definition: retypes.h:1
GLfloat GLfloat p
Definition: glext.h:8902
PARAM_TYPES aeParameters[MAX_PARAMETERS]
Definition: createspec.c:101
PSTR pszForwarder
Definition: createspec.c:94
Definition: fci.c:126

Referenced by main().

◆ EnumParametersCallback()

BOOL CALLBACK EnumParametersCallback ( _In_ PSYMBOL_INFO  pSymInfo,
_In_ ULONG  SymbolSize,
_In_ PVOID  UserContext 
)

Definition at line 378 of file createspec.c.

382 {
383  PEXPORT pExport = (PEXPORT)UserContext;
384  enum SymTagEnum eSymTag;
385  enum BasicType eBaseType;
386  DWORD dwTypeIndex;
387  ULONG64 ullLength;
388 
389  /* If it's not a parameter, skip it */
390  if (!(pSymInfo->Flags & SYMFLAG_PARAMETER))
391  {
392  return TRUE;
393  }
394 
395  /* Count this parameter */
396  pExport->cParameters++;
397 
398  /* Get the type for the parameter */
400  pSymInfo->ModBase,
401  pSymInfo->TypeIndex,
403  &eSymTag))
404  {
405  switch (eSymTag)
406  {
407  case SymTagUDT:
408  case SymTagBaseType:
409 
410  /* Try to get the size */
412  pSymInfo->ModBase,
413  pSymInfo->TypeIndex,
415  &ullLength))
416  {
417  if (ullLength > 8)
418  {
419  /* That is probably not possible */
420  __debugbreak();
421  }
422 
423  if (ullLength > 4)
424  {
425  /* 'double' type */
426  pExport->aeParameters[pExport->cParameters - 1] = TYPE_DOUBLE;
427  break;
428  }
429  }
430 
431  /* Default to 'long' type */
432  pExport->aeParameters[pExport->cParameters - 1] = TYPE_LONG;
433  break;
434 
435  case SymTagEnum:
436  /* 'long' type */
437  pExport->aeParameters[pExport->cParameters - 1] = TYPE_LONG;
438  break;
439 
440  case SymTagPointerType:
441  /* 'ptr' type */
442  pExport->aeParameters[pExport->cParameters - 1] = TYPE_PTR;
443 
444  /* Try to get the underlying type */
446  pSymInfo->ModBase,
447  pSymInfo->TypeIndex,
449  &dwTypeIndex))
450  {
451  /* Try to get the base type */
453  pSymInfo->ModBase,
454  dwTypeIndex,
456  &eBaseType))
457  {
458  /* Check for string types */
459  if (eBaseType == btChar)
460  {
461  /* 'str' type */
462  pExport->aeParameters[pExport->cParameters - 1] = TYPE_STR;
463  }
464  else if (eBaseType == btWChar)
465  {
466  /* 'wstr' type */
467  pExport->aeParameters[pExport->cParameters - 1] = TYPE_WSTR;
468  }
469  }
470  }
471  break;
472 
473  default:
474  printf("Unhandled eSymTag: %u\n", eSymTag);
475  return FALSE;
476  }
477  }
478  else
479  {
480  printf("Could not get type info. Fallig back to ptr\n");
481  pExport->aeParameters[pExport->cParameters - 1] = TYPE_PTR;
482  }
483 
484  return TRUE;
485 }
BasicType
Definition: compat.h:1256
#define TRUE
Definition: types.h:120
BOOL WINAPI SymGetTypeInfo(HANDLE hProcess, DWORD64 ModBase, ULONG TypeId, IMAGEHLP_SYMBOL_TYPE_INFO GetType, PVOID pInfo)
Definition: type.c:901
void __cdecl __debugbreak(void)
Definition: intrin_ppc.h:698
SymTagEnum
Definition: compat.h:1220
ULONG cParameters
Definition: createspec.c:100
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned __int64 ULONG64
Definition: imports.h:198
struct _EXPORT * PEXPORT
HANDLE ghProcess
Definition: createspec.c:110
#define SYMFLAG_PARAMETER
Definition: compat.h:648
PARAM_TYPES aeParameters[MAX_PARAMETERS]
Definition: createspec.c:101
#define printf
Definition: config.h:203

Referenced by ParseImageSymbols().

◆ error()

void error ( _In_ const char pszFormat,
  ... 
)

Definition at line 113 of file createspec.c.

116 {
117  CHAR szBuffer[512];
119  DWORD dwLastError;
120  va_list argptr;
121 
122  /* Get last error */
123  dwLastError = GetLastError();
124 
125  va_start(argptr, pszFormat);
126  cchBuffer = vsprintf_s(szBuffer, sizeof(szBuffer), pszFormat, argptr);
127  va_end(argptr);
128 
129  /* Strip trailing newlines */
130  _Analysis_assume_(cchBuffer < sizeof(szBuffer));
131  while ((cchBuffer >= 1) &&
132  ((szBuffer[cchBuffer - 1] == '\r') ||
133  (szBuffer[cchBuffer - 1] == '\n')))
134  {
135  szBuffer[cchBuffer - 1] = '\0';
136  cchBuffer--;
137  }
138 
139  /* Check if we have an error */
140  if (dwLastError != ERROR_SUCCESS)
141  {
142  /* Append error code */
143  cchBuffer += sprintf_s(szBuffer + cchBuffer,
144  sizeof(szBuffer) - cchBuffer,
145  " [error %lu: ", dwLastError);
146 
147  /* Format the last error code */
149  NULL,
150  dwLastError,
151  0,
152  szBuffer + cchBuffer,
153  (DWORD)(sizeof(szBuffer) - cchBuffer),
154  NULL);
155 
156  /* Strip trailing newlines */
157  _Analysis_assume_(cchBuffer < sizeof(szBuffer));
158  while ((cchBuffer >= 1) &&
159  ((szBuffer[cchBuffer - 1] == '\r') ||
160  (szBuffer[cchBuffer - 1] == '\n')))
161  {
162  szBuffer[cchBuffer - 1] = '\0';
163  cchBuffer--;
164  }
165 
166  fprintf(stderr, "%s]\n", szBuffer);
167  }
168  else
169  {
170  fprintf(stderr, "%s\n", szBuffer);
171  }
172 }
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI FormatMessageA(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:483
char CHAR
Definition: xmlstorage.h:175
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define va_end(ap)
Definition: acmsvcex.h:90
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static DWORD cchBuffer
Definition: fusion.c:83
smooth NULL
Definition: ftsmooth.c:416
char * va_list
Definition: acmsvcex.h:78
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
unsigned long DWORD
Definition: ntddk_ex.h:95
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define va_start(ap, A)
Definition: acmsvcex.h:91
FILE * stderr
#define _Analysis_assume_(expr)
Definition: no_sal2.h:10

Referenced by CreateSpecFile(), GetExportsFromFile(), GetFunctionFromForwarder(), InitDbgHelp(), main(), and ParseImageSymbols().

◆ GetCallingConvention()

const CHAR* GetCallingConvention ( _In_ PEXPORT  pExport)

Definition at line 636 of file createspec.c.

638 {
639  if (pExport->fData)
640  {
641  return "extern";
642  }
643 
644 #ifndef _M_AMD64
645  switch (pExport->dwCallingConvention)
646  {
647  case CV_CALL_NEAR_C:
648  return "cdecl";
649  case CV_CALL_NEAR_FAST:
650  return "fastcall";
651  case CV_CALL_NEAR_STD:
652  return "stdcall";
653  case CV_CALL_NEAR_SYS:
654  return "syscall";
655  case CV_CALL_THISCALL:
656  return "thiscall";
657  default:
658  __debugbreak();
659  }
660 #endif
661  return "stdcall";
662 }
void __cdecl __debugbreak(void)
Definition: intrin_ppc.h:698

Referenced by CreateSpecFile().

◆ GetExportsFromFile()

HRESULT GetExportsFromFile ( _In_ HMODULE  hmod,
_Out_ PEXPORT_DATA ppExportData 
)

Definition at line 304 of file createspec.c.

307 {
308  PBYTE pjImageBase;
309  PIMAGE_EXPORT_DIRECTORY pExportDir;
310  ULONG i, cjExportSize, cFunctions, cjTableSize;
311  PEXPORT_DATA pExportData;
312  PULONG pulAddressTable, pulNameTable;
313  PUSHORT pusOrdinalTable;
314 
315  pjImageBase = (PBYTE)hmod;
316 
317  /* Get the export directory */
318  pExportDir = ImageDirectoryEntryToData(pjImageBase,
319  TRUE,
321  &cjExportSize);
322  if (pExportDir == NULL)
323  {
324  fprintf(stderr, "Failed to get export directory\n");
325  return E_FAIL;
326  }
327 
328  cFunctions = pExportDir->NumberOfFunctions;
329  cjTableSize = FIELD_OFFSET(EXPORT_DATA, aExports[cFunctions]);
330 
331  pExportData = malloc(cjTableSize);
332  if (pExportData == NULL)
333  {
334  error("Failed to allocate %u bytes of memory for export table\n", cjTableSize);
335  return E_OUTOFMEMORY;
336  }
337 
338  RtlZeroMemory(pExportData, cjTableSize);
339 
340  pulAddressTable = (PULONG)(pjImageBase + pExportDir->AddressOfFunctions);
341 
342  pExportData->cNumberOfExports = cFunctions;
343 
344  /* Loop through the function table */
345  for (i = 0; i < cFunctions; i++)
346  {
347  PVOID pvFunction = (pjImageBase + pulAddressTable[i]);
348 
349  /* Check if this is a forwarder */
350  if ((ULONG_PTR)((PUCHAR)pvFunction - (PUCHAR)pExportDir) < cjExportSize)
351  {
352  pExportData->aExports[i].pszForwarder = _strdup(pvFunction);
353  }
354  else
355  {
356  pExportData->aExports[i].ulRva = pulAddressTable[i];
357  }
358  }
359 
360  pulNameTable = (PULONG)(pjImageBase + pExportDir->AddressOfNames);
361  pusOrdinalTable = (PUSHORT)(pjImageBase + pExportDir->AddressOfNameOrdinals);
362 
363  /* Loop through the name table */
364  for (i = 0; i < pExportDir->NumberOfNames; i++)
365  {
366  ULONG iIndex = pusOrdinalTable[i];
367  PSTR pszName = (PSTR)(pjImageBase + pulNameTable[i]);
368 
369  pExportData->aExports[iIndex].pszName = _strdup(pszName);
370  }
371 
372  *ppExportData = pExportData;
373  return S_OK;
374 }
#define TRUE
Definition: types.h:120
unsigned char * PUCHAR
Definition: retypes.h:3
#define _strdup
Definition: debug_ros.c:7
#define E_FAIL
Definition: ddrawi.h:102
DWORD AddressOfNameOrdinals
Definition: compat.h:155
uint32_t ULONG_PTR
Definition: typedefs.h:63
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
ULONG cNumberOfExports
Definition: createspec.c:106
void error(_In_ const char *pszFormat,...)
Definition: createspec.c:113
PVOID WINAPI ImageDirectoryEntryToData(PVOID base, BOOLEAN image, USHORT dir, PULONG size)
Definition: pe_module.c:914
#define IMAGE_DIRECTORY_ENTRY_EXPORT
Definition: compat.h:140
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:141
#define S_OK
Definition: intsafe.h:59
signed char * PSTR
Definition: retypes.h:7
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
unsigned int * PULONG
Definition: retypes.h:1
unsigned int ULONG
Definition: retypes.h:1
FILE * stderr
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define malloc
Definition: debug_ros.c:4
BYTE * PBYTE
Definition: pedump.c:66
unsigned short * PUSHORT
Definition: retypes.h:2
EXPORT aExports[1]
Definition: createspec.c:107

Referenced by main().

◆ GetFunctionFromForwarder()

ULONG64 GetFunctionFromForwarder ( _In_ PCSTR  pszForwarder)

Definition at line 488 of file createspec.c.

490 {
492  PCH pchDot, pszName;
493  ULONG64 ullFunction;
494  HMODULE hmod;
495 
496  /* Copy the forwarder name */
497  strcpy_s(szDllName, sizeof(szDllName), pszForwarder);
498 
499  /* Find the '.' */
500  pchDot = strchr(szDllName, '.');
501  if (pchDot == NULL)
502  {
503  error("Invalid name for forwarder '%s'!", pszForwarder);
504  return 0;
505  }
506 
507  /* Terminate DLL name */
508  *pchDot = '\0';
509 
510  /* Load the DLL */
512  if (hmod == NULL)
513  {
514  error("Failed to load module for forwarder '%s'!", pszForwarder);
515  return 0;
516  }
517 
518  /* Get the function name and check for ordinal */
519  pszName = pchDot + 1;
520  if (pszName[0] == '#')
521  {
522  ULONG iOrdinal = strtoul(pszName + 1, NULL, 10);
523  if ((iOrdinal == 0) || (iOrdinal > 0xFFFF))
524  {
525  error("Got invalid ordinal %u for ''", iOrdinal, pszForwarder);
526  return 0;
527  }
528 
529  pszName = (PSTR)(ULONG_PTR)iOrdinal;
530  }
531 
532  /* Get the function address */
533  ullFunction = (ULONG_PTR)GetProcAddress(hmod, pszName);
534  if (ullFunction == 0)
535  {
536  error("Failed to resolve '%s' in '%s'.", pchDot + 1, szDllName);
537  return 0;
538  }
539 
540  return ullFunction;
541 }
UINT32 strtoul(const char *String, char **Terminator, UINT32 Base)
Definition: utclib.c:696
static const WCHAR szDllName[]
Definition: sip.c:61
char CHAR
Definition: xmlstorage.h:175
uint32_t ULONG_PTR
Definition: typedefs.h:63
CHAR * PCH
Definition: ntbasedef.h:398
smooth NULL
Definition: ftsmooth.c:416
void error(_In_ const char *pszFormat,...)
Definition: createspec.c:113
HMODULE LoadModuleWithSymbols(_In_ PSTR pszModuleName)
Definition: createspec.c:253
#define MAX_SYM_NAME
Definition: compat.h:624
unsigned __int64 ULONG64
Definition: imports.h:198
#define strcpy_s(d, l, s)
Definition: utility.h:200
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:141
signed char * PSTR
Definition: retypes.h:7
char * strchr(const char *String, int ch)
Definition: utclib.c:501
unsigned int ULONG
Definition: retypes.h:1
#define ULONG_PTR
Definition: config.h:101
#define GetProcAddress(x, y)
Definition: compat.h:410

Referenced by ParseImageSymbols().

◆ InitDbgHelp()

BOOL InitDbgHelp ( VOID  )

Definition at line 175 of file createspec.c.

177 {
178  static const char *pszMsSymbolServer = "srv**symbols*http://msdl.microsoft.com/download/symbols";
179  DWORD Options;
180 
181  /* Save current process ;-) */
183 
184  /* Initialize dbghelp */
185  if (!SymInitialize(ghProcess, 0, FALSE))
186  {
187  error("SymInitialize() failed.");
188  return FALSE;
189  }
190 
191  /* Set options */
196 
197  /* Test if we can reach the MS symbol server */
198  if (!SymSrvIsStore(ghProcess, pszMsSymbolServer))
199  {
200  error("Failed to connect to symbol server.");
201  return FALSE;
202  }
203 
204  /* Set MS symbol server as symbol search path */
205  SymSetSearchPath(ghProcess, pszMsSymbolServer);
206 
207  return TRUE;
208 }
#define TRUE
Definition: types.h:120
DWORD WINAPI SymSetOptions(DWORD opts)
Definition: dbghelp.c:443
enum OPTION_FLAGS Options
Definition: stats.c:44
#define SYMOPT_DEFERRED_LOADS
Definition: compat.h:638
BOOL WINAPI SymSetSearchPath(HANDLE hProcess, PCSTR searchPath)
Definition: dbghelp.c:199
#define SYMOPT_INCLUDE_32BIT_MODULES
Definition: dbghelp.h:541
BOOL WINAPI SymSrvIsStore(HANDLE hProcess, PCSTR pszPath)
Definition: rosstubs.c:539
BOOL WINAPI SymInitialize(HANDLE hProcess, PCSTR UserSearchPath, BOOL fInvadeProcess)
Definition: dbghelp.c:393
#define SYMOPT_ALLOW_ABSOLUTE_SYMBOLS
Definition: symdump.c:19
void error(_In_ const char *pszFormat,...)
Definition: createspec.c:113
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1168
unsigned long DWORD
Definition: ntddk_ex.h:95
HANDLE ghProcess
Definition: createspec.c:110
DWORD WINAPI SymGetOptions(void)
Definition: dbghelp.c:458
#define SYMOPT_DEBUG
Definition: dbghelp.h:556

Referenced by main().

◆ LoadModuleWithSymbols()

HMODULE LoadModuleWithSymbols ( _In_ PSTR  pszModuleName)

Definition at line 253 of file createspec.c.

255 {
256  CHAR szFullFileName[MAX_PATH];
257  HMODULE hmod;
258 
259  /* Check if the file name has a path */
260  if (strchr(pszModuleName, '\\') != NULL)
261  {
262  /* Try as it is */
263  hmod = LoadModuleWithSymbolsFullPath(pszModuleName);
264  if (hmod != NULL)
265  {
266  return hmod;
267  }
268  }
269 
270  /* Try current directory */
271  GetCurrentDirectoryA(MAX_PATH, szFullFileName);
272  strcat_s(szFullFileName, sizeof(szFullFileName), "\\");
273  strcat_s(szFullFileName, sizeof(szFullFileName), pszModuleName);
274  hmod = LoadModuleWithSymbolsFullPath(szFullFileName);
275  if (hmod != NULL)
276  {
277  return hmod;
278  }
279 
280  /* Try system32 */
281  strcpy_s(szFullFileName, sizeof(szFullFileName), "%systemroot%\\system32\\");
282  strcat_s(szFullFileName, sizeof(szFullFileName), pszModuleName);
283  hmod = LoadModuleWithSymbolsFullPath(szFullFileName);
284  if (hmod != NULL)
285  {
286  return hmod;
287  }
288 
289 #ifdef _WIN64
290  /* Try SysWOW64 */
291  strcpy_s(szFullFileName, sizeof(szFullFileName), "%systemroot%\\SysWOW64\\");
292  strcat_s(szFullFileName, sizeof(szFullFileName), pszModuleName);
293  hmod = LoadModuleWithSymbolsFullPath(szFullFileName);
294  if (hmod != NULL)
295  {
296  return hmod;
297  }
298 #endif // _WIN64
299 
300  return NULL;
301 }
char CHAR
Definition: xmlstorage.h:175
HMODULE LoadModuleWithSymbolsFullPath(_In_ PSTR pszFullModuleFileName)
Definition: createspec.c:211
_Check_return_wat_ _CRTIMP errno_t __cdecl strcat_s(_Inout_updates_z_(_Size) char *_Dst, _In_ size_t _Size, _In_z_ const char *_Src)
smooth NULL
Definition: ftsmooth.c:416
#define MAX_PATH
Definition: compat.h:26
#define strcpy_s(d, l, s)
Definition: utility.h:200
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:141
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2145
char * strchr(const char *String, int ch)
Definition: utclib.c:501

Referenced by GetFunctionFromForwarder(), and main().

◆ LoadModuleWithSymbolsFullPath()

HMODULE LoadModuleWithSymbolsFullPath ( _In_ PSTR  pszFullModuleFileName)

Definition at line 211 of file createspec.c.

213 {
214  HMODULE hmod;
215  DWORD64 dwModuleBase;
216 
217  /* Load the DLL */
218  hmod = LoadLibraryExA(pszFullModuleFileName,
219  NULL,
223  if (hmod == NULL)
224  {
225  return NULL;
226  }
227 
228  /* Load symbols for this module */
229  dwModuleBase = SymLoadModule64(ghProcess,
230  NULL,
231  pszFullModuleFileName,
232  NULL,
233  (DWORD_PTR)hmod,
234  0);
235  if (dwModuleBase == 0)
236  {
237  /* ERROR_SUCCESS means, we have symbols already */
238  if (GetLastError() != ERROR_SUCCESS)
239  {
240  return NULL;
241  }
242  }
243  else
244  {
245  printf("Successfully loaded symbols for '%s'\n",
246  pszFullModuleFileName);
247  }
248 
249  return hmod;
250 }
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define LOAD_WITH_ALTERED_SEARCH_PATH
Definition: winbase.h:339
#define LOAD_IGNORE_CODE_AUTHZ_LEVEL
Definition: winbase.h:340
smooth NULL
Definition: ftsmooth.c:416
DWORD64 WINAPI SymLoadModule64(HANDLE hProcess, HANDLE hFile, PCSTR ImageName, PCSTR ModuleName, DWORD64 BaseOfDll, DWORD SizeOfDll)
Definition: module.c:673
#define DONT_RESOLVE_DLL_REFERENCES
Definition: winbase.h:337
uint32_t DWORD_PTR
Definition: typedefs.h:63
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:141
uint64_t DWORD64
Definition: typedefs.h:65
HANDLE ghProcess
Definition: createspec.c:110
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:157
#define printf
Definition: config.h:203

Referenced by LoadModuleWithSymbols().

◆ main()

int main ( int argc  ,
char argv[] 
)

hosttype.c Copyright (C) 2002 by Brian Palmer brian.nosp@m.p@sg.nosp@m.inet..nosp@m.com

Definition at line 732 of file createspec.c.

733 {
734  HRESULT hr;
735  CHAR szSpecFile[MAX_PATH];
736  PSTR pszSpecFile;
737  PEXPORT_DATA pExportData;
738  HMODULE hmod;
739 
740  /* Check parameters */
741  if ((argc < 2) || !strcmp(argv[1], "/?"))
742  {
743  printf("syntax: createspec <image file> [<spec file>]\n");
744  return 0;
745  }
746 
747  /* Check if we have a spec file name */
748  if (argc > 2)
749  {
750  pszSpecFile = argv[2];
751  }
752  else
753  {
754  /* Create spec file name from image file name */
755  PSTR pszStart = strrchr(argv[1], '\\');
756  if (pszStart == 0)
757  pszStart = argv[1];
758 
759  strcpy_s(szSpecFile, sizeof(szSpecFile), pszStart);
760  strcat_s(szSpecFile, sizeof(szSpecFile), ".spec");
761  pszSpecFile = szSpecFile;
762  }
763 
764  /* Initialize dbghelp.dll */
765  if (!InitDbgHelp())
766  {
767  error("Failed to init dbghelp!\n"
768  "Make sure you have dbghelp.dll and symsrv.dll in the same folder.\n");
769  return E_FAIL;
770  }
771 
772  /* Load the file including symbols */
773  printf("Loading symbols for '%s', please wait...\n", argv[1]);
775  if (hmod == NULL)
776  {
777  error("Failed to load module '%s'!", argv[1]);
778  return E_FAIL;
779  }
780 
781  /* Get the exports */
782  hr = GetExportsFromFile(hmod, &pExportData);
783  if (!SUCCEEDED(hr))
784  {
785  error("Failed to get exports: %lx\n", hr);
786  return hr;
787  }
788 
789  /* Get additional info from symbols */
790  hr = ParseImageSymbols(hmod, pExportData);
791  if (!SUCCEEDED(hr))
792  {
793  error("Failed to get symbol information: hr=%lx\n", hr);
794  }
795 
796  /* Write the spec file */
797  hr = CreateSpecFile(pszSpecFile, pExportData);
798 
799  printf("Spec file '%s' was successfully written.\n", szSpecFile);
800 
801  return hr;
802 }
HRESULT GetExportsFromFile(_In_ HMODULE hmod, _Out_ PEXPORT_DATA *ppExportData)
Definition: createspec.c:304
static int argc
Definition: ServiceArgs.c:12
HRESULT hr
Definition: shlfolder.c:183
char CHAR
Definition: xmlstorage.h:175
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
#define argv
Definition: mplay32.c:18
#define E_FAIL
Definition: ddrawi.h:102
_Check_return_wat_ _CRTIMP errno_t __cdecl strcat_s(_Inout_updates_z_(_Size) char *_Dst, _In_ size_t _Size, _In_z_ const char *_Src)
smooth NULL
Definition: ftsmooth.c:416
void error(_In_ const char *pszFormat,...)
Definition: createspec.c:113
HRESULT CreateSpecFile(_In_ PCSTR pszSpecFile, _In_ PEXPORT_DATA pExportData)
Definition: createspec.c:665
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
HMODULE LoadModuleWithSymbols(_In_ PSTR pszModuleName)
Definition: createspec.c:253
#define strcpy_s(d, l, s)
Definition: utility.h:200
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:141
HRESULT ParseImageSymbols(_In_ HMODULE hmod, _Inout_ PEXPORT_DATA pExportData)
Definition: createspec.c:544
signed char * PSTR
Definition: retypes.h:7
BOOL InitDbgHelp(VOID)
Definition: createspec.c:175
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define SUCCEEDED(hr)
Definition: intsafe.h:57
#define printf
Definition: config.h:203

◆ ParseImageSymbols()

HRESULT ParseImageSymbols ( _In_ HMODULE  hmod,
_Inout_ PEXPORT_DATA  pExportData 
)

Definition at line 544 of file createspec.c.

547 {
548  DWORD64 dwModuleBase;
549  ULONG i;
550  IMAGEHLP_STACK_FRAME StackFrame;
552 
553  dwModuleBase = (DWORD_PTR)hmod;
554 
555  /* Loop through all exports */
556  for (i = 0; i < pExportData->cNumberOfExports; i++)
557  {
558  PEXPORT pExport = &pExportData->aExports[i];
559  ULONG64 ullFunction = dwModuleBase + pExportData->aExports[i].ulRva;
560  ULONG64 ullDisplacement;
561 
562  /* Check if this is a forwarder */
563  if (pExport->pszForwarder != NULL)
564  {
565  /* Load the module and get the function address */
566  ullFunction = GetFunctionFromForwarder(pExport->pszForwarder);
567  if (ullFunction == 0)
568  {
569  printf("Failed to get function for forwarder '%s'. Skipping.\n", pExport->pszForwarder);
570  continue;
571  }
572  }
573 
574  RtlZeroMemory(&sym, sizeof(sym));
575  sym.si.SizeOfStruct = sizeof(SYMBOL_INFO);
576  sym.si.MaxNameLen = MAX_SYM_NAME;
577 
578  /* Try to find the symbol */
579  if (!SymFromAddr(ghProcess, ullFunction, &ullDisplacement, &sym.si))
580  {
581  error("Error: SymFromAddr() failed.");
582  continue;
583  }
584 
585  /* Get the symbol name */
586  pExport->pszSymbol = _strdup(sym.si.Name);
587 
588  /* Check if it is a function */
589  if (sym.si.Tag == SymTagFunction)
590  {
591  /* Get the calling convention */
593  dwModuleBase,
594  sym.si.TypeIndex,
596  &pExport->dwCallingConvention))
597  {
598  /* Fall back to __stdcall */
600  }
601 
602  /* Set the context to the function address */
603  RtlZeroMemory(&StackFrame, sizeof(StackFrame));
604  StackFrame.InstructionOffset = ullFunction;
605  if (!SymSetContext(ghProcess, &StackFrame, NULL))
606  {
607  error("SymSetContext failed for i = %u.", i);
608  continue;
609  }
610 
611  /* Enumerate all symbols for this function */
613  0, // use SymSetContext
614  NULL,
616  pExport))
617  {
618  error("SymEnumSymbols failed for i = %u.", i);
619  continue;
620  }
621  }
622  else if (sym.si.Tag == SymTagPublicSymbol)
623  {
625  }
626  else if (sym.si.Tag == SymTagData)
627  {
628  pExport->fData = TRUE;
629  }
630  }
631 
632  return S_OK;
633 }
ULONG Tag
Definition: compat.h:698
CHAR Name[1]
Definition: compat.h:701
#define TRUE
Definition: types.h:120
SYMBOL_INFO si
Definition: dbghelp.h:1159
ULONG MaxNameLen
Definition: compat.h:700
#define DWORD_PTR
Definition: treelist.c:76
BOOL WINAPI SymGetTypeInfo(HANDLE hProcess, DWORD64 ModBase, ULONG TypeId, IMAGEHLP_SYMBOL_TYPE_INFO GetType, PVOID pInfo)
Definition: type.c:901
ULONG TypeIndex
Definition: compat.h:688
#define _strdup
Definition: debug_ros.c:7
ULONG fData
Definition: createspec.c:99
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
BOOL CALLBACK EnumParametersCallback(_In_ PSYMBOL_INFO pSymInfo, _In_ ULONG SymbolSize, _In_ PVOID UserContext)
Definition: createspec.c:378
ULONG ulRva
Definition: createspec.c:95
smooth NULL
Definition: ftsmooth.c:416
void error(_In_ const char *pszFormat,...)
Definition: createspec.c:113
struct _SYMBOL_INFO SYMBOL_INFO
PSTR pszSymbol
Definition: createspec.c:93
#define MAX_SYM_NAME
Definition: compat.h:624
DWORD dwCallingConvention
Definition: createspec.c:96
unsigned __int64 ULONG64
Definition: imports.h:198
ULONG64 InstructionOffset
Definition: compat.h:1017
BOOL WINAPI SymSetContext(HANDLE hProcess, PIMAGEHLP_STACK_FRAME StackFrame, PIMAGEHLP_CONTEXT Context)
Definition: dbghelp.c:478
ULONG64 GetFunctionFromForwarder(_In_ PCSTR pszForwarder)
Definition: createspec.c:488
ULONG SizeOfStruct
Definition: compat.h:687
BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD64 Address, DWORD64 *Displacement, PSYMBOL_INFO Symbol)
Definition: symbol.c:1271
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:141
#define S_OK
Definition: intsafe.h:59
uint64_t DWORD64
Definition: typedefs.h:65
BOOL WINAPI SymEnumSymbols(HANDLE hProcess, ULONG64 BaseOfDll, PCSTR Mask, PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, PVOID UserContext)
Definition: symbol.c:1155
HANDLE ghProcess
Definition: createspec.c:110
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define printf
Definition: config.h:203
PSTR pszForwarder
Definition: createspec.c:94

Referenced by main().

Variable Documentation

◆ gapszTypeStrings

const char* gapszTypeStrings[]
Initial value:
=
{
"???",
"long",
"double",
"ptr",
"str",
"wstr"
}

Definition at line 79 of file createspec.c.

Referenced by CreateSpecFile().

◆ ghProcess