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