Fixed DPMI_CallRMProc (I think).
[wine/multimedia.git] / library / winestub.c
blobf5aa038832c6a0b226d9eacf0ebdc88ef2e43ad6
1 /* Sample winestub.c file for compiling programs with libwine.so. */
3 #include <string.h>
4 #include "windows.h"
5 #include "xmalloc.h"
7 extern int PASCAL WinMain(HINSTANCE32,HINSTANCE32,LPSTR,int);
9 /* external declaration here because we don't want to depend on Wine headers */
10 #ifdef __cplusplus
11 extern "C" HINSTANCE32 MAIN_WinelibInit( int *argc, char *argv[] );
12 #else
13 extern HINSTANCE32 MAIN_WinelibInit( int *argc, char *argv[] );
14 #endif
16 /* Most Windows C/C++ compilers use something like this to */
17 /* access argc and argv globally: */
18 int _ARGC;
19 char **_ARGV;
21 int main( int argc, char *argv [] )
23 HINSTANCE32 hInstance;
24 LPSTR lpszCmdParam;
25 int i, len = 0;
26 _ARGC = argc;
27 _ARGV = (char **)argv;
29 if (!(hInstance = MAIN_WinelibInit( &argc, argv ))) return 0;
31 /* Alloc szCmdParam */
32 for (i = 1; i < argc; i++) len += strlen(argv[i]) + 1;
33 lpszCmdParam = (LPSTR) xmalloc(len + 1);
34 /* Concatenate arguments */
35 if (argc > 1) strcpy(lpszCmdParam, argv[1]);
36 else lpszCmdParam[0] = '\0';
37 for (i = 2; i < argc; i++) strcat(strcat(lpszCmdParam, " "), argv[i]);
39 return WinMain (hInstance, /* hInstance */
40 0, /* hPrevInstance */
41 lpszCmdParam, /* lpszCmdParam */
42 SW_NORMAL); /* nCmdShow */