All, I am tracking a problem where an install program with an exception
trying to access 0x00000000 memory. I have tracked the problem down to
files/drive.c in DRIVE_GetCurrentDirectory where dos_cwd contains 0 and
is used in
ret = strlenW(dos_cwd) + 3; /* length of WHOLE current directory */
It seems that DRIVE_GetCurrentDrive returns a value greater than
MAX_DOS_DRIVES (25) and then
return DOSDrives[drive].dos_cwd; where dos_cwd=0;
pTask->curdrive and pTask->curdir appear not to be set or invalid. Now
it seems that a check for null ptr in DRIVE_GetCurrentDirectory is order ie.
UINT ret;
LPCWSTR dos_cwd = DRIVE_GetDosCwd( DRIVE_GetCurrentDrive() );
static const WCHAR driveA_rootW[] = {'A',':','\\',0};
if (dos_cwd == 0)
{
ERR("dos_cwd returned 0 instead of pointer to current working
directory\n");
dos_cwd = "\0"; /* make a valid string for strlenW */
}
ret = strlenW(dos_cwd) + 3; /* length of WHOLE current directory */
if (ret >= buflen) return ret + 1;
but what would be a good value for dos_cwd?
I am interested in what causes the pTask->curdrive to be greater than 25
and curdir to be set to ???????? as shown below.
Wine-dbg>p *pTask
{hNext=0, ss_sp=0, nEvents=0, priority=0, unused1=0, hSelf=4143,
hPrevInstance=0, unused2=0, ctrlword8087=0, flags=16, error_mode=0,
version=1024, hInstance=0,
hModule=0, hQueue=4199, hParent=0, signal_flags=0,
sighandler=0x00000000, userhandler=0x00000000,
discardhandler=0x00000000, int0=0x00000000, int2=0x00000000,
int4=0x00000000, int6=0x00000000, int7=0x00000000, int3e=0x00000000,
int75=0x00000000, compat_flags=0, unused4="", teb=0x4002f000,
unused5="", hPDB=4151, dta=272040064, curdrive=254, curdir="????????",
nCmdShow=1, hYieldTo=0, dlls_to_init=0, hCSAlias=4167, thunks={0, 21584,
0, 8, 16, 0, 0, 0, 24, 0, 0, 0, 32, 0, 0, 0,
40, 0, 0, 0, 48, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0}, module_name="",
magic=17492, hEvent=0x0000000c, pdb={int20=8397, nextParagraph=0,
reserved1=0, dispatcher="?", savedint22=0x00000000,
savedint23=0x00000000, savedint24=0x00000000, parentPSP=0,
fileHandles="????????????????????", environment=4159, saveStack=0,
nbFiles=20, fileHandlesPtr=272039960, hFileHandles=0, reserved3={0, 0,
0, ...}, ...}...}
Wine-dbg>
Jeff Latimer