Release 960606
[wine.git] / library / winestub.c
blob2f5e7228435868c5ac38fccb7587a920e6221ebf
1 /* Sample winestub.c file for compiling programs with libwine.so. */
3 #include "windows.h"
4 #include "wine.h"
5 #ifdef WIN_DEBUG
6 #include <stdio.h>
7 #endif
9 extern int PASCAL WinMain(HINSTANCE,HINSTANCE,LPSTR,int);
10 /* This is the renamed main() subroutine in misc/main.c. */
11 /* Note that the libdll `init()' won't work: */
12 extern HINSTANCE _wine_main(int, char *[]);
14 int main (int argc, char *argv [])
16 HINSTANCE hInstance;
17 char szCmdParam[256] = {0};
18 int index, buffer_pos;
19 char *arg_holder;
20 /* "Wired-in" command-line options for Wine: */
21 /*char *wine_argv[] = {argv[0], "-managed", "-dll", "+commdlg",
22 "-dll", "+shell", ""};*/
23 char *wine_argv[] = {argv[0], ""};
25 /* Initialize the library dll: */
26 hInstance = (HINSTANCE)_wine_main((sizeof(wine_argv)/sizeof(char *))-1, wine_argv);
28 #ifdef WIN_DEBUG
29 fprintf(stderr,"In winestub, reporting hInstance = %d\n", hInstance);
30 #endif
32 /* Move things from argv to the szCmdParam that WinMain expects: */
33 for (index = 1, buffer_pos = 0;
34 (index < argc) && (buffer_pos < 255);
35 index++, buffer_pos++)
37 for (arg_holder = argv[index]; ; buffer_pos++, arg_holder++)
38 if ((szCmdParam[buffer_pos] = *arg_holder) == '\0') break;
39 szCmdParam[buffer_pos] = ' ';
41 szCmdParam[buffer_pos] = '\0';
43 #ifdef WIN_DEBUG
44 fprintf(stderr,"In winestub, Program Name: %s, Parameters: %s\n",
45 progname, szCmdParam);
46 #endif
48 return WinMain (hInstance, /* hInstance */
49 0, /* hPrevInstance */
50 (LPSTR)szCmdParam, /* lpszCmdParam */
51 SW_NORMAL); /* nCmdShow */