ReactOS 0.4.15-dev-5666-gc548b97
vfdlib.c File Reference
#include <windows.h>
#include <stdio.h>
#include "vfdtypes.h"
#include "vfdapi.h"
#include "vfdlib.h"
Include dependency graph for vfdlib.c:

Go to the source code of this file.

Macros

#define WIN32_LEAN_AND_MEAN
 

Functions

BOOL WINAPI DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
 
BOOL WINAPI VfdIsValidPlatform ()
 
UINT WINAPI VfdGetNotifyMessage ()
 
PSTR ModuleMessage (DWORD nFormat,...)
 
PCSTR SystemMessage (DWORD nError)
 

Variables

HINSTANCE g_hDllModule = NULL
 
UINT g_cDllRefCnt = 0
 
UINT g_nNotifyMsg = 0
 

Macro Definition Documentation

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 15 of file vfdlib.c.

Function Documentation

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hInstance,
DWORD  dwReason,
LPVOID  lpReserved 
)

Definition at line 44 of file vfdlib.c.

48{
49#ifdef _DEBUG
50 char name[MAX_PATH];
51 HMODULE hMod;
52 DWORD size;
53
54 if (EnumProcessModules(GetCurrentProcess(), &hMod, sizeof(hMod), &size)) {
56 }
57 else {
58 strcpy(name, "unknown");
59 }
60#endif // _DEBUG
61
62 UNREFERENCED_PARAMETER(lpReserved);
63
65 VFDTRACE(0, ("DLL_PROCESS_ATTACH - %s\n", name));
66
67 // this DLL doesn't need DLL_THREAD_ATTACH and DLL_THREAD_DETACH
69
70 // store the DLL instance handle
72
73 // register the VFD notification message
75
76 }
77 else if (dwReason == DLL_PROCESS_DETACH) {
78 VFDTRACE(0, ("DLL_PROCESS_DETACH - %s\n", name));
79 }
80
81 return TRUE;
82}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
DWORD dwReason
Definition: misc.cpp:154
HINSTANCE hInstance
Definition: charmap.c:19
#define TRUE
Definition: types.h:120
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
#define GetCurrentProcess()
Definition: compat.h:759
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
BOOL WINAPI EnumProcessModules(HANDLE hProcess, HMODULE *lphModule, DWORD cb, LPDWORD lpcbNeeded)
Definition: psapi.c:526
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizeiptr size
Definition: glext.h:5919
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define GetModuleBaseName
Definition: psapi.h:132
Definition: name.c:39
#define VFDTRACE(LEVEL, STRING)
Definition: vfddbg.h:72
HINSTANCE g_hDllModule
UINT g_nNotifyMsg
#define VFD_NOTIFY_MESSAGE
Definition: vfdlib.h:48
#define RegisterWindowMessage
Definition: winuser.h:5830

◆ ModuleMessage()

PSTR ModuleMessage ( DWORD  nFormat,
  ... 
)

Definition at line 124 of file vfdlib.c.

126{
127 PSTR p;
129
130 va_start(args, nFormat);
131
132 if (!FormatMessage(
135 g_hDllModule, nFormat, 0, (LPTSTR)&p, 0, &args)) {
136 p = NULL;
137 }
138
139 va_end(args);
140
141 return p;
142}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define NULL
Definition: types.h:112
GLfloat GLfloat p
Definition: glext.h:8902
signed char * PSTR
Definition: retypes.h:7
#define args
Definition: format.c:66
Definition: match.c:390
#define FormatMessage
Definition: winbase.h:3666
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:419
#define FORMAT_MESSAGE_FROM_HMODULE
Definition: winbase.h:422
CHAR * LPTSTR
Definition: xmlstorage.h:192

Referenced by AddMenuItem(), CVfdShExt::DoVfdDrop(), OnBrowse(), OnOK(), SetControlText(), ShowHelpWindow(), VfdGuiClose(), VfdGuiFormat(), VfdImageTip(), and VfdMakeFileDesc().

◆ SystemMessage()

◆ VfdGetNotifyMessage()

UINT WINAPI VfdGetNotifyMessage ( )

Definition at line 115 of file vfdlib.c.

116{
117 return g_nNotifyMsg;
118}

◆ VfdIsValidPlatform()

BOOL WINAPI VfdIsValidPlatform ( )

Definition at line 87 of file vfdlib.c.

88{
89 BOOL (WINAPI *pfnIsWow64Process)(HANDLE, PBOOL);
90 BOOL wow64;
91
92 if (GetVersion() & 0x80000000) {
93 return FALSE; // doesn't work on Win9x
94 }
95
96 pfnIsWow64Process = (BOOL (WINAPI *)(HANDLE, PBOOL))
97 GetProcAddress(GetModuleHandle("kernel32.dll"), "IsWow64Process");
98
99 if (pfnIsWow64Process == NULL) {
100 return TRUE; // NT4 or 2000 -- assured to be 32 bit
101 }
102
103 wow64 = FALSE;
104
105 if (!pfnIsWow64Process(GetCurrentProcess(), &wow64)) {
106 return FALSE;
107 }
108
109 return !wow64;
110}
#define FALSE
Definition: types.h:117
#define GetProcAddress(x, y)
Definition: compat.h:753
unsigned int BOOL
Definition: ntddk_ex.h:94
#define BOOL
Definition: nt_native.h:43
static BOOL wow64
Definition: psapi_main.c:44
DWORD WINAPI GetVersion()
Definition: redirtest.c:5
PVOID HANDLE
Definition: typedefs.h:73
#define GetModuleHandle
Definition: winbase.h:3698
BOOL * PBOOL
Definition: windef.h:161
#define WINAPI
Definition: msvc.h:6

Referenced by main().

Variable Documentation

◆ g_cDllRefCnt

◆ g_hDllModule

◆ g_nNotifyMsg

UINT g_nNotifyMsg = 0
extern