aboutsummaryrefslogtreecommitdiff
path: root/libwinmain/winmain.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-01-31 13:18:42 +0000
committermarha <marha@users.sourceforge.net>2011-01-31 13:18:42 +0000
commit605c2377adb51f3fc7105ee92c4fb773b26d7f9b (patch)
treed1449f211a1606fb2f8ac7b4820a9ed5c5c30edd /libwinmain/winmain.c
parentedf3c29a885d3b0d6b9da683feabf48b9b20d462 (diff)
downloadvcxsrv-605c2377adb51f3fc7105ee92c4fb773b26d7f9b.tar.gz
vcxsrv-605c2377adb51f3fc7105ee92c4fb773b26d7f9b.tar.bz2
vcxsrv-605c2377adb51f3fc7105ee92c4fb773b26d7f9b.zip
main should also pass the penv variable
Diffstat (limited to 'libwinmain/winmain.c')
-rw-r--r--libwinmain/winmain.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/libwinmain/winmain.c b/libwinmain/winmain.c
index 6df140b10..126c19da4 100644
--- a/libwinmain/winmain.c
+++ b/libwinmain/winmain.c
@@ -6,7 +6,7 @@
#define MAX_CONSOLE_LINES 500
-int main(int argc, char *argv[]);
+int main(int argc, char *argv[], char *penv[]);
/* Ignore control c and control break signals */
static BOOL WINAPI IgnoreControlC(DWORD dwCtrlType)
@@ -72,6 +72,8 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
char *argv[MAXNRARGS];
char *pTmp;
char *pProgramName;
+ char **penv;
+ int Ret;
hInstance=hInstance;
nCmdShow=nCmdShow;
@@ -128,6 +130,22 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
break;
}
}
+
+ {
+ LPTCH pEnvStrings=GetEnvironmentStrings();
+ int NrEnv=0;
+ penv=malloc(sizeof(*penv));
+ while (*pEnvStrings)
+ {
+ penv=realloc(penv,(NrEnv+2)*sizeof(*penv));
+ penv[NrEnv++]=pEnvStrings;
+ while (*pEnvStrings) pEnvStrings++;
+ pEnvStrings++;
+ }
+ penv[NrEnv]=NULL;
+ }
- return main(argc,argv);
+ Ret = main(argc,argv,penv);
+ free(penv);
+ return Ret;
}