ReactOS  0.4.14-dev-115-g4576127
chklib.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include "../win32err.h"
Include dependency graph for chklib.c:

Go to the source code of this file.

Functions

static void DisplayEntryPoint (const HANDLE dll, LPCSTR SymbolName)
 
int main (int argc, char *argv [])
 

Function Documentation

◆ DisplayEntryPoint()

static void DisplayEntryPoint ( const HANDLE  dll,
LPCSTR  SymbolName 
)
static

Definition at line 95 of file chklib.c.

99 {
100  FARPROC EntryPoint;
101 
102  printf(
103  "[%s]\n",
104  SymbolName
105  );
106  EntryPoint = GetProcAddress(
107  dll,
108  SymbolName
109  );
110  if (!EntryPoint)
111  {
113  L"GetProcAddress",
114  GetLastError()
115  );
116  return;
117  }
118  printf(
119  "0x%p %s\n",
120  EntryPoint,
121  SymbolName
122  );
123 }
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static HMODULE dll
Definition: str.c:188
VOID PrintWin32Error(IN LPWSTR Message, IN DWORD ErrorCode)
Definition: main.c:146
static const WCHAR L[]
Definition: oid.c:1250
#define GetProcAddress(x, y)
Definition: compat.h:410
int(* FARPROC)()
Definition: compat.h:28
#define printf
Definition: config.h:203

Referenced by main().

◆ 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 130 of file chklib.c.

134 {
135  HINSTANCE dll;
137 
138  if (argc < 2)
139  {
140  fprintf(
141  stderr,
142  "\
143 ReactOS System Tools\n\
144 Check a Dynamic Link Library (DLL) for loading\n\
145 Copyright (c) 1998, 1999 Emanuele Aliberti\n\n\
146 usage: %s module [symbol [, ...]]\n",
147  argv[0]
148  );
150  }
151  dll = LoadLibraryA(argv[1]);
152  if (!dll)
153  {
154  UINT LastError;
155 
156  LastError = GetLastError();
157  PrintWin32Error(L"LoadLibrary",LastError);
158  fprintf(
159  stderr,
160  "%s: loading %s failed (%d).\n",
161  argv[0],
162  argv[1],
163  LastError
164  );
166  }
168  (HANDLE) dll,
169  ModuleName,
170  sizeof ModuleName
171  );
172  printf(
173  "%s loaded.\n",
174  ModuleName
175  );
176 #ifdef DISPLAY_VERSION
177  DisplayVersion(dll,ModuleName);
178 #endif
179  if (argc > 2)
180  {
181  int CurrentSymbol;
182 
183  for ( CurrentSymbol = 2;
184  (CurrentSymbol < argc);
185  ++CurrentSymbol
186  )
187  {
188  DisplayEntryPoint( dll, argv[CurrentSymbol] );
189  }
190  }
191  FreeLibrary(dll);
192  printf(
193  "%s unloaded.\n",
194  ModuleName
195  );
196  return EXIT_SUCCESS;
197 }
static int argc
Definition: ServiceArgs.c:12
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char * ModuleName
Definition: acpixf.h:1264
#define argv
Definition: mplay32.c:18
static HMODULE dll
Definition: str.c:188
#define EXIT_SUCCESS
Definition: rdjpgcom.c:55
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
VOID PrintWin32Error(IN LPWSTR Message, IN DWORD ErrorCode)
Definition: main.c:146
#define _MAX_PATH
Definition: utility.h:77
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
char TCHAR
Definition: xmlstorage.h:189
#define FreeLibrary(x)
Definition: compat.h:405
#define EXIT_FAILURE
Definition: jerror.c:33
#define GetModuleFileName
Definition: winbase.h:3655
static const WCHAR L[]
Definition: oid.c:1250
unsigned int UINT
Definition: ndis.h:50
static void DisplayEntryPoint(const HANDLE dll, LPCSTR SymbolName)
Definition: chklib.c:95
FILE * stderr
void exit(int exitcode)
Definition: _exit.c:33
#define printf
Definition: config.h:203