Initialize the PIB at startup.
Otherwise, it won't be available to DLL init code when run before the main executable starts. Fixes Watcom C's wlink.exe crashing because it gets a NULL command line.
This commit is contained in:
1 parent
7dcce0cbd8
commit
cbffb2ff60
3 files changed
+142
-123
No files matched your search
+4
-15
@@ -265,22 +265,11 @@ APIRET DosGetInfoBlocks(PTIB *pptib, PPIB *pppib)
|
||||
{
|
||||
TRACE_NATIVE("DosGetInfoBlocks(%p, %p)", pptib, pppib);
|
||||
|
||||
if (pptib != NULL) {
|
||||
if (pptib != NULL)
|
||||
*pptib = getTib();
|
||||
} // if
|
||||
|
||||
if (pppib != NULL) {
|
||||
static PIB pib;
|
||||
if (pib.pib_ulpid == 0) {
|
||||
// !!! FIXME: this is seriously incomplete.
|
||||
pib.pib_hmte = (HMODULE) GLoaderState->main_module;
|
||||
pib.pib_ulpid = (uint32) getpid();
|
||||
pib.pib_ulppid = (uint32) getppid();
|
||||
pib.pib_pchcmd = GLoaderState->main_module->cmd;
|
||||
pib.pib_pchenv = GLoaderState->main_module->env;
|
||||
} // if
|
||||
*pppib = &pib;
|
||||
} // if
|
||||
if (pppib != NULL)
|
||||
*pppib = (PPIB) &GLoaderState->pib;
|
||||
|
||||
return 0;
|
||||
} // DosGetInfoBlocks
|
||||
@@ -382,7 +371,7 @@ APIRET DosScanEnv(PSZ name, PSZ *outval)
|
||||
{
|
||||
TRACE_NATIVE("DosScanEnv('%s', %p)", name, outval);
|
||||
|
||||
char *env = GLoaderState->main_module->env;
|
||||
char *env = GLoaderState->pib.pib_pchenv;
|
||||
const size_t len = strlen(name);
|
||||
while (*env) {
|
||||
if ((strncmp(env, name, len) == 0) && (env[len] == '=')) {
|
||||
|
||||
Reference in new issue
Block a user