-temporary and ugly fix/work-around for a bug that made CreateFileW crash

when calling it directly (meaning not indirectly thru CreateFileA)

svn path=/trunk/; revision=6836
This commit is contained in:
Gunnar Dalsnes 2003-11-30 20:48:07 +00:00
parent 0901ecbf1a
commit 1c863eef7a

View file

@ -1,4 +1,4 @@
/* $Id: path.c,v 1.25 2003/11/17 20:35:46 sedwards Exp $ /* $Id: path.c,v 1.26 2003/11/30 20:48:07 gdalsnes Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -555,6 +555,9 @@ RtlGetFullPathName_U(PWSTR DosName,
DPRINT("RtlGetFullPathName_U %S %ld %p %p\n", DPRINT("RtlGetFullPathName_U %S %ld %p %p\n",
DosName, size, buf, FilePart); DosName, size, buf, FilePart);
/* FIXME: this code is a mess! We should use Wine's implementation
of this function, since it's cleaner and IMO better. -Gunnar */
if (!DosName || !*DosName) if (!DosName || !*DosName)
return 0; return 0;
@ -601,9 +604,15 @@ DPRINT("type %ld\n", type);
case 6: /* \\.\xxx */ case 6: /* \\.\xxx */
break; break;
case 2: /* x:\xxx */ case 2:
*DosName = RtlUpcaseUnicodeChar (*DosName); break;
break; #if 0
/* this makes a direct CreateFileW call crash! */
case 2: /* x:\xxx */
*DosName = RtlUpcaseUnicodeChar (*DosName);
break;
#endif
case 3: /* x:xxx */ case 3: /* x:xxx */
drive = RtlUpcaseUnicodeChar (*DosName); drive = RtlUpcaseUnicodeChar (*DosName);
@ -674,11 +683,17 @@ CHECKPOINT;
return 0; return 0;
} }
RtlReleasePebLock(); RtlReleasePebLock();
DPRINT("TempFullPathName \'%S\' DosName \'%S\' len %ld\n", TempFullPathName, DosName, len); DPRINT("TempFullPathName \'%S\' DosName \'%S\' len %ld\n", TempFullPathName, DosName, len);
/* add dosname to prefix */ /* add dosname to prefix */
memcpy (TempFullPathName + templen, DosName, len * sizeof(WCHAR)); memcpy (TempFullPathName + templen, DosName, len * sizeof(WCHAR));
/* dirty/temporary fix for the CreateFileW problem */
if (type == 2){
TempFullPathName[0] = RtlUpcaseUnicodeChar(TempFullPathName[0]);
}
len += templen; len += templen;
TempFullPathName[len] = 0; TempFullPathName[len] = 0;
@ -754,6 +769,7 @@ RtlDosPathNameToNtPathName_U(PWSTR dosname,
WCHAR fullname[MAX_PATH + 1]; WCHAR fullname[MAX_PATH + 1];
PWSTR Buffer = NULL; PWSTR Buffer = NULL;
RtlAcquirePebLock (); RtlAcquirePebLock ();
RtlInitUnicodeString (&us, dosname); RtlInitUnicodeString (&us, dosname);
@ -848,7 +864,6 @@ RtlDosPathNameToNtPathName_U(PWSTR dosname,
} }
RtlReleasePebLock(); RtlReleasePebLock();
return TRUE; return TRUE;
} }