ReactOS  0.4.15-dev-5608-gafb953a
rundll32.c File Reference
#include <stdarg.h>
#include <stdlib.h>
#include <windef.h>
#include <winbase.h>
#include <winnls.h>
#include <winuser.h>
#include <tchar.h>
#include "resource.h"
Include dependency graph for rundll32.c:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 
#define FreeConvertedWideChar(lpwString)   free(lpwString)
 
#define ConvertToMultiByte(lptString)   (lptString)
 
#define FreeConvertedMultiByte(lpaString)
 

Typedefs

typedef int(WINAPIDllWinMainW) (HWND hWnd, HINSTANCE hInstance, LPWSTR lpwCmdLine, int nCmdShow)
 
typedef int(WINAPIDllWinMainA) (HWND hWnd, HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
 

Functions

LPTSTR *WINAPI CommandLineToArgv (LPCTSTR lpCmdLine, int *lpArgc)
 
void GetModuleTitle (void)
 
LPWSTR ConvertToWideChar (LPCSTR lpString)
 
LPSTR DuplicateToMultiByte (LPCTSTR lptString, size_t nBufferSize)
 
LRESULT CALLBACK EmptyWindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL RegisterBlankClass (HINSTANCE hInstance, HINSTANCE hPrevInstance)
 
int WINAPI _tWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
 

Variables

LPCTSTR rundll32_wtitle = _T("rundll32")
 
LPCTSTR rundll32_wclass = _T("rundll32_window")
 
TCHAR ModuleFileName [MAX_PATH+1]
 
LPTSTR ModuleTitle
 

Macro Definition Documentation

◆ ConvertToMultiByte

#define ConvertToMultiByte (   lptString)    (lptString)

Definition at line 274 of file rundll32.c.

◆ FreeConvertedMultiByte

#define FreeConvertedMultiByte (   lpaString)

Definition at line 275 of file rundll32.c.

◆ FreeConvertedWideChar

#define FreeConvertedWideChar (   lpwString)    free(lpwString)

Definition at line 261 of file rundll32.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 24 of file rundll32.c.

Typedef Documentation

◆ DllWinMainA

typedef int(WINAPI * DllWinMainA) (HWND hWnd, HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)

Definition at line 41 of file rundll32.c.

◆ DllWinMainW

typedef int(WINAPI * DllWinMainW) (HWND hWnd, HINSTANCE hInstance, LPWSTR lpwCmdLine, int nCmdShow)

Definition at line 35 of file rundll32.c.

Function Documentation

◆ _tWinMain()

int WINAPI _tWinMain ( HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
LPTSTR  lpCmdLine,
int  nCmdShow 
)

Definition at line 328 of file rundll32.c.

334 {
335  int argc;
336  TCHAR szMsg[RC_STRING_MAX_SIZE];
337 
338  LPTSTR *argv;
339  LPTSTR lptCmdLine,lptDllName,lptFuncName,lptMsgBuffer;
340  WCHAR ResolvedFile[MAX_PATH + 1] = {0}, *lpManifestName;
341  LPSTR lpFuncName,lpaCmdLine;
342  LPWSTR lpwCmdLine;
343  HMODULE hDll;
344  DllWinMainW fnDllWinMainW;
345  DllWinMainA fnDllWinMainA;
346  HWND hWindow;
347  int i;
348  size_t nStrLen;
349 
350  ACTCTXW ActCtx = {sizeof(ACTCTX), ACTCTX_FLAG_RESOURCE_NAME_VALID};
351  HANDLE hActCtx;
353  BOOL bActivated;
354 
355  // Get command-line in argc-argv format
357 
358  // Skip all beginning arguments starting with a slash (/)
359  for (i = 1; i < argc; i++)
360  if (*argv[i] != _T('/')) break;
361 
362  // If no dll was specified, there is nothing to do
363  if (i >= argc) {
364  if (argv) free(argv);
365  return 0;
366  }
367 
368  lptDllName = argv[i++];
369 
370  // The next argument, which specifies the name of the dll function,
371  // can either have a comma between it and the dll filename or a space.
372  // Using a comma here is the preferred method
373  if (i < argc)
374  lptFuncName = argv[i++];
375  else
376  lptFuncName = _T("");
377 
378  // If no function name was specified, nothing needs to be done
379  if (!*lptFuncName) {
380  if (argv) free(argv);
381  return 0;
382  }
383 
384  // The rest of the arguments will be passed to dll function
385  if (i < argc)
386  lptCmdLine = argv[i];
387  else
388  lptCmdLine = _T("");
389 
390  lpManifestName = lptDllName;
391  if (GetFileAttributesW(lptDllName) == INVALID_FILE_ATTRIBUTES)
392  {
393  LPWSTR FilePart = NULL;
394  if (SearchPathW(NULL, lptDllName, NULL, _countof(ResolvedFile) - 1, ResolvedFile, &FilePart))
395  {
396  lpManifestName = ResolvedFile;
397  }
398  }
399 
400  // FIXME: If there is a .manifest file next to the input file, we should use that instead!
401  ActCtx.lpSource = lpManifestName;
402  ActCtx.lpResourceName = (LPCWSTR)123;
403  hActCtx = CreateActCtx(&ActCtx);
404  bActivated = (hActCtx != INVALID_HANDLE_VALUE ? ActivateActCtx(hActCtx, &cookie) : FALSE);
405 
406  // Everything is all setup, so load the dll now
407  hDll = LoadLibrary(lptDllName);
408  if (hDll) {
409  nStrLen = _tcslen(lptFuncName);
410  // Make a non-unicode version of the function name,
411  // since that is all GetProcAddress accepts
412  lpFuncName = DuplicateToMultiByte(lptFuncName,nStrLen + 2);
413 
414 #ifdef UNICODE
415  lpFuncName[nStrLen] = 'W';
416  lpFuncName[nStrLen+1] = 0;
417  // Get address of unicode version of the dll function if it exists
418  fnDllWinMainW = (DllWinMainW)GetProcAddress(hDll,lpFuncName);
419  fnDllWinMainA = 0;
420  if (!fnDllWinMainW) {
421  // If no unicode function was found, get the address of the non-unicode function
422  lpFuncName[nStrLen] = 'A';
423  fnDllWinMainA = (DllWinMainA)GetProcAddress(hDll,lpFuncName);
424  if (!fnDllWinMainA) {
425  // If first non-unicode function was not found, get the address
426  // of the other non-unicode function
427  lpFuncName[nStrLen] = 0;
428  fnDllWinMainA = (DllWinMainA)GetProcAddress(hDll,lpFuncName);
429  }
430  }
431 #else
432  // Get address of non-unicode version of the dll function if it exists
433  fnDllWinMainA = (DllWinMainA)GetProcAddress(hDll,lpFuncName);
434  fnDllWinMainW = 0;
435  if (!fnDllWinMainA) {
436  // If first non-unicode function was not found, get the address
437  // of the other non-unicode function
438  lpFuncName[nStrLen] = 'A';
439  lpFuncName[nStrLen+1] = 0;
440  fnDllWinMainA = (DllWinMainA)GetProcAddress(hDll,lpFuncName);
441  if (!fnDllWinMainA) {
442  // If non-unicode function was not found, get the address of the unicode function
443  lpFuncName[nStrLen] = 'W';
444  fnDllWinMainW = (DllWinMainW)GetProcAddress(hDll,lpFuncName);
445  }
446  }
447 #endif
448 
449  free(lpFuncName);
450 
451  if (!RegisterBlankClass(hInstance, hPrevInstance))
452  {
453  FreeLibrary(hDll);
454  if (bActivated)
456  return 0;
457  }
458  // Create a window so we can pass a window handle to
459  // the dll function; this is required
461 
462  if (fnDllWinMainW) {
463  // Convert the command-line string to unicode and call the dll function
464  lpwCmdLine = ConvertToWideChar(lptCmdLine);
465  fnDllWinMainW(hWindow,hInstance,lpwCmdLine,nCmdShow);
466  FreeConvertedWideChar(lpwCmdLine);
467  }
468  else if (fnDllWinMainA) {
469  // Convert the command-line string to ansi and call the dll function
470  lpaCmdLine = ConvertToMultiByte(lptCmdLine);
471  fnDllWinMainA(hWindow,hInstance,lpaCmdLine,nCmdShow);
472  FreeConvertedMultiByte(lpaCmdLine);
473  }
474  else {
475  // The specified dll function was not found; display an error message
476  GetModuleTitle();
478 
479  lptMsgBuffer = (LPTSTR)malloc((_tcslen(szMsg) - 4 + _tcslen(lptFuncName) + _tcslen(lptDllName) + 1) * sizeof(TCHAR));
480  _stprintf(lptMsgBuffer,szMsg,lptFuncName,lptDllName);
481  MessageBox(0,lptMsgBuffer,ModuleTitle,MB_ICONERROR);
482  free(lptMsgBuffer);
483  }
484 
485  DestroyWindow(hWindow);
487 
488  // The dll function has finished executing, so unload it
489  FreeLibrary(hDll);
490  }
491  else {
492  // The dll could not be loaded; display an error message
493  GetModuleTitle();
495 
496  lptMsgBuffer = (LPTSTR)malloc((_tcslen(szMsg) - 2 + _tcslen(lptDllName) + 1) * sizeof(TCHAR));
497  _stprintf(lptMsgBuffer,szMsg,lptDllName);
498 
499  MessageBox(0,lptMsgBuffer,ModuleTitle,MB_ICONERROR);
500  free(lptMsgBuffer);
501  }
502 
503  if (bActivated)
505 
506  if (argv) free(argv);
507  return 0; /* rundll32 always returns 0! */
508 }
BOOL WINAPI ActivateActCtx(IN HANDLE hActCtx, OUT PULONG_PTR ulCookie)
Definition: actctx.c:237
static int argc
Definition: ServiceArgs.c:12
#define LoadLibrary
Definition: winbase.h:3733
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
LPCTSTR rundll32_wtitle
Definition: rundll32.c:52
#define free
Definition: debug_ros.c:5
BOOL RegisterBlankClass(HINSTANCE hInstance, HINSTANCE hPrevInstance)
Definition: rundll32.c:308
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define IDS_MissingEntry
Definition: resource.h:9
#define FreeConvertedWideChar(lpwString)
Definition: rundll32.c:261
#define argv
Definition: mplay32.c:18
char * LPSTR
Definition: xmlstorage.h:182
BOOL WINAPI DestroyWindow(_In_ HWND)
LPSTR DuplicateToMultiByte(LPCTSTR lptString, size_t nBufferSize)
Definition: rundll32.c:284
CHAR * LPTSTR
Definition: xmlstorage.h:192
uint32_t ULONG_PTR
Definition: typedefs.h:65
BOOL WINAPI DeactivateActCtx(IN DWORD dwFlags, IN ULONG_PTR ulCookie)
Definition: actctx.c:268
HINSTANCE hInstance
Definition: charmap.c:19
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
#define CreateWindowEx
Definition: winuser.h:5745
#define CW_USEDEFAULT
Definition: winuser.h:225
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
#define GetCommandLine
Definition: winbase.h:3670
#define FreeConvertedMultiByte(lpaString)
Definition: rundll32.c:275
LPCTSTR rundll32_wclass
Definition: rundll32.c:53
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define FreeLibrary(x)
Definition: compat.h:748
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
_In_ PCWSTR _Out_ PVOID * ActCtx
Definition: ldrtypes.h:247
#define MB_ICONERROR
Definition: winuser.h:781
#define MessageBox
Definition: winuser.h:5812
DWORD WINAPI SearchPathW(IN LPCWSTR lpPath OPTIONAL, IN LPCWSTR lpFileName, IN LPCWSTR lpExtension OPTIONAL, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart OPTIONAL)
Definition: path.c:1298
#define _stprintf
Definition: utility.h:124
LPTSTR *WINAPI CommandLineToArgv(LPCTSTR lpCmdLine, int *lpArgc)
Definition: rundll32.c:63
#define IDS_DllNotLoaded
Definition: resource.h:8
#define GetModuleHandle
Definition: winbase.h:3698
int(WINAPI * DllWinMainW)(HWND hWnd, HINSTANCE hInstance, LPWSTR lpwCmdLine, int nCmdShow)
Definition: rundll32.c:35
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
Definition: cookie.c:33
#define NULL
Definition: types.h:112
#define ConvertToMultiByte(lptString)
Definition: rundll32.c:274
LPTSTR ModuleTitle
Definition: rundll32.c:56
void GetModuleTitle(void)
Definition: rundll32.c:217
LPWSTR ConvertToWideChar(LPCSTR lpString)
Definition: rundll32.c:248
#define GetProcAddress(x, y)
Definition: compat.h:753
#define malloc
Definition: debug_ros.c:4
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define UnregisterClass
Definition: winuser.h:5851
int(WINAPI * DllWinMainA)(HWND hWnd, HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
Definition: rundll32.c:41
#define LoadString
Definition: winuser.h:5809
#define RC_STRING_MAX_SIZE
Definition: resource.h:3

◆ CommandLineToArgv()

LPTSTR* WINAPI CommandLineToArgv ( LPCTSTR  lpCmdLine,
int lpArgc 
)

Definition at line 63 of file rundll32.c.

64 {
65  LPTSTR *argv, lpSrc, lpDest, lpArg;
66  int argc, nBSlash, nNames;
67  BOOL bInQuotes, bFirstChar;
68 
69  // If null was passed in for lpCmdLine, there are no arguments
70  if (!lpCmdLine) {
71  if (lpArgc)
72  *lpArgc = 0;
73  return 0;
74  }
75 
76  lpSrc = (LPTSTR)lpCmdLine;
77  // Skip spaces at beginning
78  while (*lpSrc == _T(' ') || *lpSrc == _T('\t'))
79  lpSrc++;
80 
81  // If command-line starts with null, there are no arguments
82  if (*lpSrc == 0) {
83  if (lpArgc)
84  *lpArgc = 0;
85  return 0;
86  }
87 
88  lpArg = lpSrc;
89  argc = 0;
90  nBSlash = 0;
91  bInQuotes = FALSE;
92  bFirstChar = TRUE;
93  nNames = 0;
94 
95  // Count the number of arguments
96  while (nNames < 4) {
97  if (*lpSrc == 0 || (*lpSrc == _T(',') && nNames == 2) || ((*lpSrc == _T(' ') || *lpSrc == _T('\t')) && !bInQuotes)) {
98  // Whitespace not enclosed in quotes signals the start of another argument
99  argc++;
100 
101  // Skip whitespace between arguments
102  while (*lpSrc == _T(' ') || *lpSrc == _T('\t') || (*lpSrc == _T(',') && nNames == 2))
103  lpSrc++;
104  if (*lpSrc == 0)
105  break;
106  if (nNames >= 3) {
107  // Increment the count for the last argument
108  argc++;
109  break;
110  }
111  nBSlash = 0;
112  bFirstChar = TRUE;
113  continue;
114  }
115  else if (*lpSrc == _T('\\')) {
116  // Count consecutive backslashes
117  nBSlash++;
118  bFirstChar = FALSE;
119  }
120  else if (*lpSrc == _T('\"') && !(nBSlash & 1)) {
121  // Open or close quotes
122  bInQuotes = !bInQuotes;
123  nBSlash = 0;
124  }
125  else {
126  // Some other character
127  nBSlash = 0;
128  if (bFirstChar && ((*lpSrc != _T('/') && nNames <= 1) || nNames > 1))
129  nNames++;
130  bFirstChar = FALSE;
131  }
132  lpSrc++;
133  }
134 
135  // Allocate space for the pointers in argv and the strings in one block
136  argv = (LPTSTR *)malloc(argc * sizeof(LPTSTR) + (_tcslen(lpArg) + 1) * sizeof(TCHAR));
137 
138  if (!argv) {
139  // Memory allocation failed
140  if (lpArgc)
141  *lpArgc = 0;
142  return 0;
143  }
144 
145  lpSrc = lpArg;
146  lpDest = lpArg = (LPTSTR)(argv + argc);
147  argc = 0;
148  nBSlash = 0;
149  bInQuotes = FALSE;
150  bFirstChar = TRUE;
151  nNames = 0;
152 
153  // Fill the argument array
154  while (nNames < 4) {
155  if (*lpSrc == 0 || (*lpSrc == _T(',') && nNames == 2) || ((*lpSrc == _T(' ') || *lpSrc == _T('\t')) && !bInQuotes)) {
156  // Whitespace not enclosed in quotes signals the start of another argument
157  // Null-terminate argument
158  *lpDest++ = 0;
159  argv[argc++] = lpArg;
160 
161  // Skip whitespace between arguments
162  while (*lpSrc == _T(' ') || *lpSrc == _T('\t') || (*lpSrc == _T(',') && nNames == 2))
163  lpSrc++;
164  if (*lpSrc == 0)
165  break;
166  lpArg = lpDest;
167  if (nNames >= 3) {
168  // Copy the rest of the command-line to the last argument
169  argv[argc++] = lpArg;
170  _tcscpy(lpArg,lpSrc);
171  break;
172  }
173  nBSlash = 0;
174  bFirstChar = TRUE;
175  continue;
176  }
177  else if (*lpSrc == _T('\\')) {
178  *lpDest++ = _T('\\');
179  lpSrc++;
180 
181  // Count consecutive backslashes
182  nBSlash++;
183  bFirstChar = FALSE;
184  }
185  else if (*lpSrc == _T('\"')) {
186  if (!(nBSlash & 1)) {
187  // If an even number of backslashes are before the quotes,
188  // the quotes don't go in the output
189  lpDest -= nBSlash / 2;
190  bInQuotes = !bInQuotes;
191  }
192  else {
193  // If an odd number of backslashes are before the quotes,
194  // output a quote
195  lpDest -= (nBSlash + 1) / 2;
196  *lpDest++ = _T('\"');
197  bFirstChar = FALSE;
198  }
199  lpSrc++;
200  nBSlash = 0;
201  }
202  else {
203  // Copy other characters
204  if (bFirstChar && ((*lpSrc != _T('/') && nNames <= 1) || nNames > 1))
205  nNames++;
206  *lpDest++ = *lpSrc++;
207  nBSlash = 0;
208  bFirstChar = FALSE;
209  }
210  }
211 
212  if (lpArgc)
213  *lpArgc = argc;
214  return argv;
215 }
static int argc
Definition: ServiceArgs.c:12
#define TRUE
Definition: types.h:120
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
#define argv
Definition: mplay32.c:18
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define malloc
Definition: debug_ros.c:4

Referenced by _tWinMain().

◆ ConvertToWideChar()

LPWSTR ConvertToWideChar ( LPCSTR  lpString)

Definition at line 248 of file rundll32.c.

249 {
250  LPWSTR lpwString;
251  size_t nStrLen;
252 
253  nStrLen = strlen(lpString) + 1;
254 
255  lpwString = (LPWSTR)malloc(nStrLen * sizeof(WCHAR));
256  MultiByteToWideChar(0,0,lpString,nStrLen,lpwString,nStrLen);
257 
258  return lpwString;
259 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MultiByteToWideChar
Definition: compat.h:110
#define malloc
Definition: debug_ros.c:4
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by _tWinMain().

◆ DuplicateToMultiByte()

LPSTR DuplicateToMultiByte ( LPCTSTR  lptString,
size_t  nBufferSize 
)

Definition at line 284 of file rundll32.c.

285 {
286  LPSTR lpString;
287  size_t nStrLen;
288 
289  nStrLen = _tcslen(lptString) + 1;
290  if (nBufferSize == 0) nBufferSize = nStrLen;
291 
292  lpString = (LPSTR)malloc(nBufferSize);
293 #ifdef UNICODE
294  WideCharToMultiByte(0,0,lptString,nStrLen,lpString,nBufferSize,0,0);
295 #else
296  strncpy(lpString,lptString,nBufferSize);
297 #endif
298 
299  return lpString;
300 }
#define WideCharToMultiByte
Definition: compat.h:111
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
char * LPSTR
Definition: xmlstorage.h:182
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
#define malloc
Definition: debug_ros.c:4

Referenced by _tWinMain().

◆ EmptyWindowProc()

LRESULT CALLBACK EmptyWindowProc ( HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 302 of file rundll32.c.

303 {
304  return DefWindowProc(hWnd, uMsg, wParam, lParam);
305 }
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
#define DefWindowProc
Definition: ros2win.h:31
LPARAM lParam
Definition: combotst.c:139

Referenced by RegisterBlankClass().

◆ GetModuleTitle()

void GetModuleTitle ( void  )

Definition at line 217 of file rundll32.c.

218 {
219  LPTSTR lpStr;
220 
223 
224  for (lpStr = ModuleFileName;*lpStr;lpStr++) {
225  if (*lpStr == _T('\\'))
226  ModuleTitle = lpStr+1;
227  }
228 
229  for (lpStr = ModuleTitle;*lpStr;lpStr++) {
230  if (_tcsicmp(lpStr,_T(".exe"))==0)
231  break;
232  }
233 
234  *lpStr = 0;
235 }
#define _tcsicmp
Definition: xmlstorage.h:205
CHAR * LPTSTR
Definition: xmlstorage.h:192
TCHAR ModuleFileName[MAX_PATH+1]
Definition: rundll32.c:55
#define _T(x)
Definition: vfdio.h:22
#define MAX_PATH
Definition: compat.h:34
#define GetModuleFileName
Definition: winbase.h:3702
LPTSTR ModuleTitle
Definition: rundll32.c:56

Referenced by _tWinMain().

◆ RegisterBlankClass()

BOOL RegisterBlankClass ( HINSTANCE  hInstance,
HINSTANCE  hPrevInstance 
)

Definition at line 308 of file rundll32.c.

309 {
310  WNDCLASSEX wcex;
311 
312  wcex.cbSize = sizeof(WNDCLASSEX);
313  wcex.style = 0;
315  wcex.cbClsExtra = 0;
316  wcex.cbWndExtra = 0;
317  wcex.hInstance = hInstance;
318  wcex.hIcon = 0;
319  wcex.hCursor = 0;
320  wcex.hbrBackground = 0;
321  wcex.lpszMenuName = 0;
323  wcex.hIconSm = 0;
324 
325  return (RegisterClassEx(&wcex) != (ATOM)0);
326 }
UINT style
Definition: winuser.h:3192
LPCSTR lpszMenuName
Definition: winuser.h:3200
#define RegisterClassEx
Definition: winuser.h:5827
HCURSOR hCursor
Definition: winuser.h:3198
WNDPROC lpfnWndProc
Definition: winuser.h:3193
LPCSTR lpszClassName
Definition: winuser.h:3201
WORD ATOM
Definition: dimm.idl:113
HICON hIconSm
Definition: winuser.h:3202
HINSTANCE hInstance
Definition: charmap.c:19
HINSTANCE hInstance
Definition: winuser.h:3196
LRESULT CALLBACK EmptyWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: rundll32.c:302
UINT cbSize
Definition: winuser.h:3191
HBRUSH hbrBackground
Definition: winuser.h:3199
LPCTSTR rundll32_wclass
Definition: rundll32.c:53
int cbWndExtra
Definition: winuser.h:3195
HICON hIcon
Definition: winuser.h:3197
int cbClsExtra
Definition: winuser.h:3194
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5709

Referenced by _tWinMain().

Variable Documentation

◆ ModuleFileName

TCHAR ModuleFileName[MAX_PATH+1]

Definition at line 55 of file rundll32.c.

Referenced by GetModuleTitle(), and MiQueryMemorySectionName().

◆ ModuleTitle

LPTSTR ModuleTitle

Definition at line 56 of file rundll32.c.

Referenced by _tWinMain(), and GetModuleTitle().

◆ rundll32_wclass

LPCTSTR rundll32_wclass = _T("rundll32_window")

Definition at line 53 of file rundll32.c.

Referenced by _tWinMain(), and RegisterBlankClass().

◆ rundll32_wtitle

LPCTSTR rundll32_wtitle = _T("rundll32")

Definition at line 52 of file rundll32.c.

Referenced by _tWinMain().