ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
August 2005
----- 2025 -----
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
23 participants
669 discussions
Start a n
N
ew thread
[hbirr] 17298: Defined DbgPrint.
by hbirr@svn.reactos.com
Defined DbgPrint. Modified: trunk/reactos/lib/crt/include/internal/debug.h _____ Modified: trunk/reactos/lib/crt/include/internal/debug.h --- trunk/reactos/lib/crt/include/internal/debug.h 2005-08-11 19:46:39 UTC (rev 17297) +++ trunk/reactos/lib/crt/include/internal/debug.h 2005-08-11 19:49:47 UTC (rev 17298) @@ -28,8 +28,8 @@ #define sT "s" #endif +unsigned long DbgPrint(char *Format,...); - #define TRACE(...)
19 years, 4 months
1
0
0
0
[hbirr] 17297: Fixed the loading of the global flag.
by hbirr@svn.reactos.com
Fixed the loading of the global flag. Modified: trunk/reactos/lib/ntdll/ldr/startup.c _____ Modified: trunk/reactos/lib/ntdll/ldr/startup.c --- trunk/reactos/lib/ntdll/ldr/startup.c 2005-08-11 19:44:36 UTC (rev 17296) +++ trunk/reactos/lib/ntdll/ldr/startup.c 2005-08-11 19:46:39 UTC (rev 17297) @@ -66,14 +66,35 @@ NTSTATUS Status = STATUS_SUCCESS; ULONG Value = 0; UNICODE_STRING ValueString; + UNICODE_STRING ImageName; + UNICODE_STRING ImagePathName; WCHAR ValueBuffer[64]; ULONG ValueSize; if (Peb->ProcessParameters && Peb->ProcessParameters->ImagePathName.Length > 0) { + DPRINT("%wZ\n", &Peb->ProcessParameters->ImagePathName); + + ImagePathName = Peb->ProcessParameters->ImagePathName; + ImageName.Buffer = ImagePathName.Buffer + ImagePathName.Length / sizeof(WCHAR); + ImageName.Length = 0; + while (ImagePathName.Buffer < ImageName.Buffer) + { + ImageName.Buffer--; + if (*ImageName.Buffer == L'\\') + { + ImageName.Buffer++; + break; + } + } + ImageName.Length = ImagePathName.Length - (ImageName.Buffer - ImagePathName.Buffer) * sizeof(WCHAR); + ImageName.MaximumLength = ImageName.Length + ImagePathName.MaximumLength - ImagePathName.Length; + + DPRINT("%wZ\n", &ImageName); + /* global flag */ - Status = LdrQueryImageFileExecutionOptions (&Peb->ProcessParameters->ImagePathName, + Status = LdrQueryImageFileExecutionOptions (&ImageName, L"GlobalFlag", REG_SZ, (PVOID)ValueBuffer, @@ -81,12 +102,15 @@ &ValueSize); if (NT_SUCCESS(Status)) { - ValueString.Buffer = ValueBuffer + 1; - ValueString.Length = ValueSize - 2 * sizeof(WCHAR); + ValueString.Buffer = ValueBuffer; + ValueString.Length = ValueSize - sizeof(WCHAR); ValueString.MaximumLength = sizeof(ValueBuffer); - RtlUnicodeStringToInteger(&ValueString, 16, &Value); - Peb->NtGlobalFlag |= Value; - DPRINT("GlobalFlag: Key='%S', Value=%08x\n", ValueBuffer, Value); + Status = RtlUnicodeStringToInteger(&ValueString, 16, &Value); + if (NT_SUCCESS(Status)) + { + Peb->NtGlobalFlag |= Value; + DPRINT("GlobalFlag: Key='%S', Value=%08x\n", ValueBuffer, Value); + } } /* * FIXME:
19 years, 4 months
1
0
0
0
[hbirr] 17296: - Open the BaseNamedObjects directory case insensitive.
by hbirr@svn.reactos.com
- Open the BaseNamedObjects directory case insensitive. - Interpret INVALID_HANDLE_VALUE for the console handle as NULL. Modified: trunk/reactos/lib/kernel32/misc/dllmain.c _____ Modified: trunk/reactos/lib/kernel32/misc/dllmain.c --- trunk/reactos/lib/kernel32/misc/dllmain.c 2005-08-11 19:37:29 UTC (rev 17295) +++ trunk/reactos/lib/kernel32/misc/dllmain.c 2005-08-11 19:44:36 UTC (rev 17296) @@ -60,7 +60,7 @@ InitializeObjectAttributes(&ObjectAttributes, &Name, - OBJ_PERMANENT, + OBJ_CASE_INSENSITIVE|OBJ_PERMANENT, NULL, NULL); @@ -133,12 +133,16 @@ } else { + if (Parameters->ConsoleHandle == INVALID_HANDLE_VALUE) + { + Parameters->ConsoleHandle = 0; + } DPRINT("Using existing console: %x\n", Parameters->ConsoleHandle); } /* Initialize Console Ctrl Handler */ - RtlInitializeCriticalSection(&ConsoleLock); - SetConsoleCtrlHandler(DefaultConsoleCtrlHandler, TRUE); + RtlInitializeCriticalSection(&ConsoleLock); + SetConsoleCtrlHandler(DefaultConsoleCtrlHandler, TRUE); /* Now use the proper console handle */ Request.Data.AllocConsoleRequest.Console = Parameters->ConsoleHandle;
19 years, 4 months
1
0
0
0
[hbirr] 17295: Honour the inheritance of a handle if it would be duplicated or opened.
by hbirr@svn.reactos.com
Honour the inheritance of a handle if it would be duplicated or opened. Modified: trunk/reactos/lib/crt/io/dup.c Modified: trunk/reactos/lib/crt/io/open.c _____ Modified: trunk/reactos/lib/crt/io/dup.c --- trunk/reactos/lib/crt/io/dup.c 2005-08-11 19:32:02 UTC (rev 17294) +++ trunk/reactos/lib/crt/io/dup.c 2005-08-11 19:37:29 UTC (rev 17295) @@ -13,25 +13,27 @@ HANDLE hProcess = GetCurrentProcess(); BOOL result; int fd; + int mode; hFile = (HANDLE)_get_osfhandle(handle); if (hFile == INVALID_HANDLE_VALUE) { __set_errno(EBADF); return -1; } + mode = __fileno_getmode(handle); result = DuplicateHandle(hProcess, hFile, hProcess, &hFile, 0, - TRUE, + mode & FNOINHERIT ? FALSE : TRUE, DUPLICATE_SAME_ACCESS); if (result == FALSE) { _dosmaperr(GetLastError()); return -1; } - fd = alloc_fd(hFile, __fileno_getmode(handle)); + fd = alloc_fd(hFile, mode); if (fd < 0) { CloseHandle(hFile); _____ Modified: trunk/reactos/lib/crt/io/open.c --- trunk/reactos/lib/crt/io/open.c 2005-08-11 19:32:02 UTC (rev 17294) +++ trunk/reactos/lib/crt/io/open.c 2005-08-11 19:37:29 UTC (rev 17295) @@ -523,7 +523,7 @@ hProcess, &fdinfo(handle2)->hFile, 0, - TRUE, + fdinfo(handle1)->fdflags & FNOINHERIT ? FALSE : TRUE, DUPLICATE_SAME_ACCESS); if (result) { // _pioinfo[handle2]->fd = handle2;
19 years, 4 months
1
0
0
0
[hbirr] 17294: Call the registered exit functions if the dll is unloaded.
by hbirr@svn.reactos.com
Call the registered exit functions if the dll is unloaded. Modified: trunk/reactos/lib/crt/stdlib/_exit.c Modified: trunk/reactos/lib/crt/stdlib/atexit.c Modified: trunk/reactos/lib/crtdll/dllmain.c Modified: trunk/reactos/lib/msvcrt/dllmain.c _____ Modified: trunk/reactos/lib/crt/stdlib/_exit.c --- trunk/reactos/lib/crt/stdlib/_exit.c 2005-08-11 19:11:17 UTC (rev 17293) +++ trunk/reactos/lib/crt/stdlib/_exit.c 2005-08-11 19:32:02 UTC (rev 17294) @@ -12,13 +12,7 @@ void exit(int status) { //int i; - struct __atexit *a = __atexit_ptr; - __atexit_ptr = 0; /* to prevent infinite loops */ - while (a) - { - (a->__function)(); - a = a->__next; - } + /* if (__stdio_cleanup_hook) __stdio_cleanup_hook(); _____ Modified: trunk/reactos/lib/crt/stdlib/atexit.c --- trunk/reactos/lib/crt/stdlib/atexit.c 2005-08-11 19:11:17 UTC (rev 17293) +++ trunk/reactos/lib/crt/stdlib/atexit.c 2005-08-11 19:32:02 UTC (rev 17294) @@ -2,6 +2,19 @@ #include <stdlib.h> #include <internal/atexit.h> +void _atexit_cleanup(void) +{ + struct __atexit *next, *a = __atexit_ptr; + __atexit_ptr = 0; /* to prevent infinite loops */ + while (a) + { + (a->__function)(); + next = a->__next; + free(a); + a = next; + } +} + /* * @implemented * _____ Modified: trunk/reactos/lib/crtdll/dllmain.c --- trunk/reactos/lib/crtdll/dllmain.c 2005-08-11 19:11:17 UTC (rev 17293) +++ trunk/reactos/lib/crtdll/dllmain.c 2005-08-11 19:32:02 UTC (rev 17294) @@ -38,6 +38,7 @@ extern int BlockEnvToEnvironA(void); extern int BlockEnvToEnvironW(void); extern void FreeEnvironment(char **environment); +extern void _atexit_cleanup(void); extern unsigned int _osver; extern unsigned int _winminor; @@ -174,6 +175,7 @@ DPRINT("Detach %d\n", nAttachCount); /* FIXME: more cleanup... */ _fcloseall(); + _atexit_cleanup(); /* destroy tls stuff */ DestroyThreadData(); _____ Modified: trunk/reactos/lib/msvcrt/dllmain.c --- trunk/reactos/lib/msvcrt/dllmain.c 2005-08-11 19:11:17 UTC (rev 17293) +++ trunk/reactos/lib/msvcrt/dllmain.c 2005-08-11 19:32:02 UTC (rev 17294) @@ -37,6 +37,7 @@ extern int BlockEnvToEnvironA(void); extern int BlockEnvToEnvironW(void); extern void FreeEnvironment(char **environment); +extern void _atexit_cleanup(void); extern unsigned int _osver; extern unsigned int _winminor; @@ -116,6 +117,7 @@ //DPRINT("Detach\n"); /* FIXME: more cleanup... */ _fcloseall(); + _atexit_cleanup(); /* destroy tls stuff */ DestroyThreadData();
19 years, 4 months
1
0
0
0
[hbirr] 17293: Fixed some problems if special parameters are delivered like SL_RESTART_SCAN, SL_INDEX_SPECIFIED or SL_RETURN_SINGLE_ENTRY.
by hbirr@svn.reactos.com
Fixed some problems if special parameters are delivered like SL_RESTART_SCAN, SL_INDEX_SPECIFIED or SL_RETURN_SINGLE_ENTRY. Modified: trunk/reactos/drivers/fs/vfat/dir.c _____ Modified: trunk/reactos/drivers/fs/vfat/dir.c --- trunk/reactos/drivers/fs/vfat/dir.c 2005-08-11 19:07:11 UTC (rev 17292) +++ trunk/reactos/drivers/fs/vfat/dir.c 2005-08-11 19:11:17 UTC (rev 17293) @@ -298,13 +298,12 @@ long BufferLength = 0; PUNICODE_STRING pSearchPattern = NULL; FILE_INFORMATION_CLASS FileInformationClass; - unsigned long FileIndex = 0; unsigned char *Buffer = NULL; PFILE_NAMES_INFORMATION Buffer0 = NULL; PVFATFCB pFcb; PVFATCCB pCcb; - BOOLEAN First = FALSE; - BOOLEAN FirstCall; + BOOLEAN FirstQuery = FALSE; + BOOLEAN FirstCall = TRUE; VFAT_DIRENTRY_CONTEXT DirContext; WCHAR LongNameBuffer[LONGNAME_MAX_LENGTH + 1]; WCHAR ShortNameBuffer[13]; @@ -348,12 +347,11 @@ #endif FileInformationClass = Stack->Parameters.QueryDirectory.FileInformationClass; - FileIndex = Stack->Parameters.QueryDirectory.FileIndex; if (pSearchPattern) { if (!pCcb->SearchPattern.Buffer) { - First = TRUE; + FirstQuery = TRUE; pCcb->SearchPattern.MaximumLength = pSearchPattern->Length + sizeof(WCHAR); pCcb->SearchPattern.Buffer = ExAllocatePool(NonPagedPool, pCcb->SearchPattern.MaximumLength); if (!pCcb->SearchPattern.Buffer) @@ -367,7 +365,7 @@ } else if (!pCcb->SearchPattern.Buffer) { - First = TRUE; + FirstQuery = TRUE; pCcb->SearchPattern.MaximumLength = 2 * sizeof(WCHAR); pCcb->SearchPattern.Buffer = ExAllocatePool(NonPagedPool, 2 * sizeof(WCHAR)); if (!pCcb->SearchPattern.Buffer) @@ -382,18 +380,15 @@ if (IrpContext->Stack->Flags & SL_INDEX_SPECIFIED) { - DirContext.DirIndex = pCcb->Entry = pCcb->CurrentByteOffset.u.LowPart; - FirstCall = TRUE; + DirContext.DirIndex = pCcb->Entry = Stack->Parameters.QueryDirectory.FileIndex; } - else if (First || (IrpContext->Stack->Flags & SL_RESTART_SCAN)) + else if (FirstQuery || (IrpContext->Stack->Flags & SL_RESTART_SCAN)) { DirContext.DirIndex = pCcb->Entry = 0; - FirstCall = TRUE; } else { DirContext.DirIndex = pCcb->Entry; - FirstCall = FALSE; } DPRINT ("Buffer=%x tofind=%wZ\n", Buffer, &pCcb->SearchPattern); @@ -442,21 +437,13 @@ } if (RC == STATUS_BUFFER_OVERFLOW) { - if (Buffer0) - { - Buffer0->NextEntryOffset = 0; - } break; } } else { - if (Buffer0) + if (FirstQuery) { - Buffer0->NextEntryOffset = 0; - } - if (First) - { RC = STATUS_NO_SUCH_FILE; } else @@ -466,21 +453,18 @@ break; } Buffer0 = (PFILE_NAMES_INFORMATION) Buffer; - Buffer0->FileIndex = FileIndex++; + Buffer0->FileIndex = DirContext.DirIndex; pCcb->Entry = ++DirContext.DirIndex; + BufferLength -= Buffer0->NextEntryOffset; if (IrpContext->Stack->Flags & SL_RETURN_SINGLE_ENTRY) { break; } - BufferLength -= Buffer0->NextEntryOffset; Buffer += Buffer0->NextEntryOffset; } if (Buffer0) { Buffer0->NextEntryOffset = 0; - } - if (FileIndex > 0) - { RC = STATUS_SUCCESS; IrpContext->Irp->IoStatus.Information = Stack->Parameters.QueryDirectory.Length - BufferLength;
19 years, 4 months
1
0
0
0
[hbirr] 17292: Implemented IRP_MJ_QUERY_VOLUME_INFORMATION/FileFsDeviceInformation. Msvcrt needs to detect the device type.
by hbirr@svn.reactos.com
Implemented IRP_MJ_QUERY_VOLUME_INFORMATION/FileFsDeviceInformation. Msvcrt needs to detect the device type. Modified: trunk/reactos/drivers/dd/null/null.c _____ Modified: trunk/reactos/drivers/dd/null/null.c --- trunk/reactos/drivers/dd/null/null.c 2005-08-11 19:02:31 UTC (rev 17291) +++ trunk/reactos/drivers/dd/null/null.c 2005-08-11 19:07:11 UTC (rev 17292) @@ -26,90 +26,119 @@ NTSTATUS STDCALL NullDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp) { - PIO_STACK_LOCATION piosStack = IoGetCurrentIrpStackLocation(Irp); - NTSTATUS nErrCode; + PIO_STACK_LOCATION piosStack = IoGetCurrentIrpStackLocation(Irp); + NTSTATUS nErrCode; - nErrCode = STATUS_SUCCESS; - Irp->IoStatus.Information = 0; + nErrCode = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; - switch(piosStack->MajorFunction) - { - /* opening and closing handles to the device */ - case IRP_MJ_CREATE: - case IRP_MJ_CLOSE: - switch(NULL_DEVICE_TYPE(DeviceObject)) - { - case NullBitBucket: - case NullZeroStream: - break; + switch(piosStack->MajorFunction) + { + /* opening and closing handles to the device */ + case IRP_MJ_CREATE: + case IRP_MJ_CLOSE: + switch(NULL_DEVICE_TYPE(DeviceObject)) + { + case NullBitBucket: + case NullZeroStream: + break; - default: - ASSERT(FALSE); - } + default: + ASSERT(FALSE); + } - break; + break; - /* write data */ - case IRP_MJ_WRITE: - { - switch(NULL_DEVICE_TYPE(DeviceObject)) - { - case NullBitBucket: - Irp->IoStatus.Information = piosStack->Parameters.Write.Length; - break; + /* write data */ + case IRP_MJ_WRITE: + { + switch(NULL_DEVICE_TYPE(DeviceObject)) + { + case NullBitBucket: + Irp->IoStatus.Information = piosStack->Parameters.Write.Length; + break; - case NullZeroStream: - nErrCode = STATUS_INVALID_DEVICE_REQUEST; - break; + case NullZeroStream: + nErrCode = STATUS_INVALID_DEVICE_REQUEST; + break; - default: - ASSERT(FALSE); - } + default: + ASSERT(FALSE); + } - break; - } + break; + } - /* read data */ - case IRP_MJ_READ: - { - switch(NULL_DEVICE_TYPE(DeviceObject)) - { - case NullBitBucket: - nErrCode = STATUS_END_OF_FILE; - break; + /* read data */ + case IRP_MJ_READ: + { + switch(NULL_DEVICE_TYPE(DeviceObject)) + { + case NullBitBucket: + nErrCode = STATUS_END_OF_FILE; + break; - case NullZeroStream: - _SEH_TRY - { - RtlZeroMemory(Irp->AssociatedIrp.SystemBuffer, piosStack->Parameters.Read.Length); - Irp->IoStatus.Information = piosStack->Parameters.Read.Length; - } - _SEH_HANDLE - { - nErrCode = _SEH_GetExceptionCode(); - } - _SEH_END; + case NullZeroStream: + _SEH_TRY + { + RtlZeroMemory(Irp->AssociatedIrp.SystemBuffer, piosStack->Parameters.Read.Length); + Irp->IoStatus.Information = piosStack->Parameters.Read.Length; + } + _SEH_HANDLE + { + nErrCode = _SEH_GetExceptionCode(); + } + _SEH_END; - break; + break; - default: - ASSERT(FALSE); + default: + ASSERT(FALSE); - } + } - break; - } + break; + } - default: - Irp->IoStatus.Information = 0; - nErrCode = STATUS_NOT_IMPLEMENTED; + case IRP_MJ_QUERY_VOLUME_INFORMATION: + switch(piosStack->Parameters.QueryVolume.FsInformationClass) + { + case FileFsDeviceInformation: + { + ULONG BufferLength = piosStack->Parameters.QueryVolume.Length; + PFILE_FS_DEVICE_INFORMATION FsDeviceInfo = (PFILE_FS_DEVICE_INFORMATION)Irp->AssociatedIrp.SystemBuffer; - } + if (BufferLength >= sizeof(FILE_FS_DEVICE_INFORMATION)) + { + FsDeviceInfo->DeviceType = FILE_DEVICE_NULL; + FsDeviceInfo->Characteristics = 0; /* FIXME: fix this !! */ + Irp->IoStatus.Information = sizeof(FILE_FS_DEVICE_INFORMATION); + nErrCode = STATUS_SUCCESS; + } + else + { + Irp->IoStatus.Information = 0; + nErrCode = STATUS_BUFFER_OVERFLOW; + } + } + break; - Irp->IoStatus.Status = nErrCode; - IoCompleteRequest(Irp, IO_NO_INCREMENT); + default: + Irp->IoStatus.Information = 0; + nErrCode = STATUS_NOT_IMPLEMENTED; + } + break; - return (nErrCode); + default: + Irp->IoStatus.Information = 0; + nErrCode = STATUS_NOT_IMPLEMENTED; + + } + + Irp->IoStatus.Status = nErrCode; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return (nErrCode); } VOID STDCALL @@ -121,62 +150,56 @@ NTSTATUS STDCALL DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) { - PDEVICE_OBJECT pdoNullDevice; - PDEVICE_OBJECT pdoZeroDevice; - UNICODE_STRING wstrNullDeviceName = RTL_CONSTANT_STRING(L"\\Device\\Null"); - UNICODE_STRING wstrZeroDeviceName = RTL_CONSTANT_STRING(L"\\Device\\Zero"); - NTSTATUS nErrCode; + PDEVICE_OBJECT pdoNullDevice; + PDEVICE_OBJECT pdoZeroDevice; + UNICODE_STRING wstrNullDeviceName = RTL_CONSTANT_STRING(L"\\Device\\Null"); + UNICODE_STRING wstrZeroDeviceName = RTL_CONSTANT_STRING(L"\\Device\\Zero"); + NTSTATUS nErrCode; - /* register driver routines */ - DriverObject->MajorFunction[IRP_MJ_CLOSE] = NullDispatch; - DriverObject->MajorFunction[IRP_MJ_CREATE] = NullDispatch; - DriverObject->MajorFunction[IRP_MJ_WRITE] = NullDispatch; - DriverObject->MajorFunction[IRP_MJ_READ] = NullDispatch; - DriverObject->DriverUnload = NullUnload; + /* register driver routines */ + DriverObject->MajorFunction[IRP_MJ_CLOSE] = NullDispatch; + DriverObject->MajorFunction[IRP_MJ_CREATE] = NullDispatch; + DriverObject->MajorFunction[IRP_MJ_WRITE] = NullDispatch; + DriverObject->MajorFunction[IRP_MJ_READ] = NullDispatch; + DriverObject->DriverUnload = NullUnload; - /* create null device */ - nErrCode = IoCreateDevice - ( - DriverObject, - sizeof(NULL_EXTENSION), - &wstrNullDeviceName, - FILE_DEVICE_NULL, - 0, - FALSE, - &pdoNullDevice - ); + /* create null device */ + nErrCode = IoCreateDevice(DriverObject, + sizeof(NULL_EXTENSION), + &wstrNullDeviceName, + FILE_DEVICE_NULL, + 0, + FALSE, + &pdoNullDevice); - /* failure */ - if(!NT_SUCCESS(nErrCode)) - { - return (nErrCode); - } + /* failure */ + if(!NT_SUCCESS(nErrCode)) + { + return (nErrCode); + } - pdoNullDevice->DeviceExtension = (PVOID)&nxNull; + pdoNullDevice->DeviceExtension = (PVOID)&nxNull; - /* create zero device */ - nErrCode = IoCreateDevice - ( - DriverObject, - sizeof(NULL_EXTENSION), - &wstrZeroDeviceName, - FILE_DEVICE_NULL, - FILE_READ_ONLY_DEVICE, /* zero device is read-only */ - FALSE, - &pdoZeroDevice - ); + /* create zero device */ + nErrCode = IoCreateDevice(DriverObject, + sizeof(NULL_EXTENSION), + &wstrZeroDeviceName, + FILE_DEVICE_NULL, + FILE_READ_ONLY_DEVICE, /* zero device is read-only */ + FALSE, + &pdoZeroDevice); - /* failure */ - if(!NT_SUCCESS(nErrCode)) - { - IoDeleteDevice(pdoNullDevice); - return (nErrCode); - } + /* failure */ + if(!NT_SUCCESS(nErrCode)) + { + IoDeleteDevice(pdoNullDevice); + return (nErrCode); + } - pdoZeroDevice->DeviceExtension = (PVOID)&nxZero; - pdoZeroDevice->Flags |= DO_BUFFERED_IO; + pdoZeroDevice->DeviceExtension = (PVOID)&nxZero; + pdoZeroDevice->Flags |= DO_BUFFERED_IO; - return (nErrCode); + return (nErrCode); } /* EOF */
19 years, 4 months
1
0
0
0
[hbirr] 17291: Reimplemented FindFirstFileEx and removed some overhead.
by hbirr@svn.reactos.com
Reimplemented FindFirstFileEx and removed some overhead. Modified: trunk/reactos/lib/kernel32/file/find.c _____ Modified: trunk/reactos/lib/kernel32/file/find.c --- trunk/reactos/lib/kernel32/file/find.c 2005-08-11 18:49:40 UTC (rev 17290) +++ trunk/reactos/lib/kernel32/file/find.c 2005-08-11 19:02:31 UTC (rev 17291) @@ -28,20 +28,98 @@ typedef struct _KERNEL32_FIND_FILE_DATA { HANDLE DirectoryHandle; + BOOLEAN DirectoryOnly; PFILE_BOTH_DIR_INFORMATION pFileInfo; } KERNEL32_FIND_FILE_DATA, *PKERNEL32_FIND_FILE_DATA; /* FUNCTIONS ****************************************************************/ +VOID +InternalCopyFindDataW(LPWIN32_FIND_DATAW lpFindFileData, + PFILE_BOTH_DIR_INFORMATION lpFileInfo) +{ + lpFindFileData->dwFileAttributes = lpFileInfo->FileAttributes; + lpFindFileData->ftCreationTime.dwHighDateTime = lpFileInfo->CreationTime.u.HighPart; + lpFindFileData->ftCreationTime.dwLowDateTime = lpFileInfo->CreationTime.u.LowPart; + + lpFindFileData->ftLastAccessTime.dwHighDateTime = lpFileInfo->LastAccessTime.u.HighPart; + lpFindFileData->ftLastAccessTime.dwLowDateTime = lpFileInfo->LastAccessTime.u.LowPart; + + lpFindFileData->ftLastWriteTime.dwHighDateTime = lpFileInfo->LastWriteTime.u.HighPart; + lpFindFileData->ftLastWriteTime.dwLowDateTime = lpFileInfo->LastWriteTime.u.LowPart; + + lpFindFileData->nFileSizeHigh = lpFileInfo->EndOfFile.u.HighPart; + lpFindFileData->nFileSizeLow = lpFileInfo->EndOfFile.u.LowPart; + + memcpy (lpFindFileData->cFileName, lpFileInfo->FileName, lpFileInfo->FileNameLength); + lpFindFileData->cFileName[lpFileInfo->FileNameLength / sizeof(WCHAR)] = 0; + + memcpy (lpFindFileData->cAlternateFileName, lpFileInfo->ShortName, lpFileInfo->ShortNameLength); + lpFindFileData->cAlternateFileName[lpFileInfo->ShortNameLength / sizeof(WCHAR)] = 0; +} + +VOID +InternalCopyFindDataA(LPWIN32_FIND_DATAA lpFindFileData, + PFILE_BOTH_DIR_INFORMATION lpFileInfo) +{ + UNICODE_STRING FileNameU; + ANSI_STRING FileNameA; + + lpFindFileData->dwFileAttributes = lpFileInfo->FileAttributes; + + lpFindFileData->ftCreationTime.dwHighDateTime = lpFileInfo->CreationTime.u.HighPart; + lpFindFileData->ftCreationTime.dwLowDateTime = lpFileInfo->CreationTime.u.LowPart; + + lpFindFileData->ftLastAccessTime.dwHighDateTime = lpFileInfo->LastAccessTime.u.HighPart; + lpFindFileData->ftLastAccessTime.dwLowDateTime = lpFileInfo->LastAccessTime.u.LowPart; + + lpFindFileData->ftLastWriteTime.dwHighDateTime = lpFileInfo->LastWriteTime.u.HighPart; + lpFindFileData->ftLastWriteTime.dwLowDateTime = lpFileInfo->LastWriteTime.u.LowPart; + + lpFindFileData->nFileSizeHigh = lpFileInfo->EndOfFile.u.HighPart; + lpFindFileData->nFileSizeLow = lpFileInfo->EndOfFile.u.LowPart; + + FileNameU.Length = FileNameU.MaximumLength = lpFileInfo->FileNameLength; + FileNameU.Buffer = lpFileInfo->FileName; + + FileNameA.MaximumLength = sizeof(lpFindFileData->cFileName) - sizeof(CHAR); + FileNameA.Buffer = lpFindFileData->cFileName; + + /* convert unicode string to ansi (or oem) */ + if (bIsFileApiAnsi) + RtlUnicodeStringToAnsiString (&FileNameA, &FileNameU, FALSE); + else + RtlUnicodeStringToOemString (&FileNameA, &FileNameU, FALSE); + + FileNameA.Buffer[FileNameA.Length] = 0; + + DPRINT("lpFileInfo->ShortNameLength %d\n", lpFileInfo->ShortNameLength); + + FileNameU.Length = FileNameU.MaximumLength = lpFileInfo->ShortNameLength; + FileNameU.Buffer = lpFileInfo->ShortName; + + FileNameA.MaximumLength = sizeof(lpFindFileData->cAlternateFileName) - sizeof(CHAR); + FileNameA.Buffer = lpFindFileData->cAlternateFileName; + + /* convert unicode string to ansi (or oem) */ + if (bIsFileApiAnsi) + RtlUnicodeStringToAnsiString (&FileNameA, &FileNameU, FALSE); + else + RtlUnicodeStringToOemString (&FileNameA, &FileNameU, FALSE); + + FileNameA.Buffer[FileNameA.Length] = 0; +} + /* * @implemented */ BOOL STDCALL InternalFindNextFile ( - HANDLE hFindFile + HANDLE hFindFile, + PUNICODE_STRING SearchPattern ) { PKERNEL32_FIND_FILE_DATA IData; @@ -52,32 +130,40 @@ IData = (PKERNEL32_FIND_FILE_DATA)hFindFile; - if (IData->pFileInfo->NextEntryOffset != 0) - { - IData->pFileInfo = (PVOID)((ULONG_PTR)IData->pFileInfo + IData->pFileInfo->NextEntryOffset); - DPRINT("Found %.*S\n",IData->pFileInfo->FileNameLength/sizeof(WCHAR), IData->pFileInfo->FileName); - return TRUE; - } - IData->pFileInfo = (PVOID)((ULONG_PTR)IData + sizeof(KERNEL32_FIND_FILE_DATA)); - IData->pFileInfo->FileIndex = 0; - Status = NtQueryDirectoryFile (IData->DirectoryHandle, - NULL, - NULL, - NULL, - &IoStatusBlock, - (PVOID)IData->pFileInfo, - FIND_DATA_SIZE, - FileBothDirectoryInformation, - FALSE, - NULL, - FALSE); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus (Status); - return FALSE; - } - DPRINT("Found %.*S\n",IData->pFileInfo->FileNameLength/sizeof(WCHAR), IData->pFileInfo->FileName); - return TRUE; + while (1) + { + if (IData->pFileInfo->NextEntryOffset != 0) + { + IData->pFileInfo = (PVOID)((ULONG_PTR)IData->pFileInfo + IData->pFileInfo->NextEntryOffset); + } + else + { + IData->pFileInfo = (PVOID)((ULONG_PTR)IData + sizeof(KERNEL32_FIND_FILE_DATA)); + IData->pFileInfo->FileIndex = 0; + Status = NtQueryDirectoryFile (IData->DirectoryHandle, + NULL, + NULL, + NULL, + &IoStatusBlock, + (PVOID)IData->pFileInfo, + FIND_DATA_SIZE, + FileBothDirectoryInformation, + SearchPattern ? TRUE : FALSE, + SearchPattern, + SearchPattern ? TRUE : FALSE); + SearchPattern = NULL; + if (!NT_SUCCESS(Status)) + { + SetLastErrorByStatus (Status); + return FALSE; + } + } + if (!IData->DirectoryOnly || IData->pFileInfo->FileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + DPRINT("Found %.*S\n",IData->pFileInfo->FileNameLength/sizeof(WCHAR), IData->pFileInfo->FileName); + return TRUE; + } + } } @@ -87,7 +173,8 @@ HANDLE STDCALL InternalFindFirstFile ( - LPCWSTR lpFileName + LPCWSTR lpFileName, + BOOLEAN DirectoryOnly ) { OBJECT_ATTRIBUTES ObjectAttributes; @@ -273,34 +360,22 @@ } IData->pFileInfo = (PVOID)((ULONG_PTR)IData + sizeof(KERNEL32_FIND_FILE_DATA)); IData->pFileInfo->FileIndex = 0; + IData->DirectoryOnly = DirectoryOnly; - Status = NtQueryDirectoryFile (IData->DirectoryHandle, - NULL, - NULL, - NULL, - &IoStatusBlock, - (PVOID)IData->pFileInfo, - FIND_DATA_SIZE, - FileBothDirectoryInformation, - TRUE, - &PatternStr, - TRUE); + bResult = InternalFindNextFile((HANDLE)IData, &PatternStr); if (NULL != SlashlessFileName) { RtlFreeHeap(hProcessHeap, 0, SlashlessFileName); } - if (!NT_SUCCESS(Status)) - { - DPRINT("Status %lx\n", Status); - CloseHandle (IData->DirectoryHandle); - RtlFreeHeap (hProcessHeap, 0, IData); - SetLastErrorByStatus (Status); - return NULL; - } - DPRINT("Found %.*S\n",IData->pFileInfo->FileNameLength/sizeof(WCHAR), IData->pFileInfo->FileName); + if (!bResult) + { + FindClose((HANDLE)IData); + return NULL; + } + return IData; } @@ -332,7 +407,7 @@ &FileName, TRUE); - IData = InternalFindFirstFile (FileNameU.Buffer); + IData = InternalFindFirstFile (FileNameU.Buffer, FALSE); RtlFreeUnicodeString (&FileNameU); @@ -346,59 +421,9 @@ IData->pFileInfo->FileNameLength); /* copy data into WIN32_FIND_DATA structure */ - lpFindFileData->dwFileAttributes = IData->pFileInfo->FileAttributes; + InternalCopyFindDataA(lpFindFileData, IData->pFileInfo); - lpFindFileData->ftCreationTime.dwHighDateTime = IData->pFileInfo->CreationTime.u.HighPart; - lpFindFileData->ftCreationTime.dwLowDateTime = IData->pFileInfo->CreationTime.u.LowPart; - lpFindFileData->ftLastAccessTime.dwHighDateTime = IData->pFileInfo->LastAccessTime.u.HighPart; - lpFindFileData->ftLastAccessTime.dwLowDateTime = IData->pFileInfo->LastAccessTime.u.LowPart; - - lpFindFileData->ftLastWriteTime.dwHighDateTime = IData->pFileInfo->LastWriteTime.u.HighPart; - lpFindFileData->ftLastWriteTime.dwLowDateTime = IData->pFileInfo->LastWriteTime.u.LowPart; - - lpFindFileData->nFileSizeHigh = IData->pFileInfo->EndOfFile.u.HighPart; - lpFindFileData->nFileSizeLow = IData->pFileInfo->EndOfFile.u.LowPart; - - FileNameU.Length = IData->pFileInfo->FileNameLength; - FileNameU.MaximumLength = FileNameU.Length + sizeof(WCHAR); - FileNameU.Buffer = IData->pFileInfo->FileName; - - FileName.Length = 0; - FileName.MaximumLength = MAX_PATH; - FileName.Buffer = lpFindFileData->cFileName; - - /* convert unicode string to ansi (or oem) */ - if (bIsFileApiAnsi) - RtlUnicodeStringToAnsiString (&FileName, - &FileNameU, - FALSE); - else - RtlUnicodeStringToOemString (&FileName, - &FileNameU, - FALSE); - - DPRINT("IData->pFileInfo->ShortNameLength %d\n", - IData->pFileInfo->ShortNameLength); - - FileNameU.Length = IData->pFileInfo->ShortNameLength; - FileNameU.MaximumLength = FileNameU.Length + sizeof(WCHAR); - FileNameU.Buffer = IData->pFileInfo->ShortName; - - FileName.Length = 0; - FileName.MaximumLength = 14; - FileName.Buffer = lpFindFileData->cAlternateFileName; - - /* convert unicode string to ansi (or oem) */ - if (bIsFileApiAnsi) - RtlUnicodeStringToAnsiString (&FileName, - &FileNameU, - FALSE); - else - RtlUnicodeStringToOemString (&FileName, - &FileNameU, - FALSE); - return (HANDLE)IData; } @@ -413,8 +438,6 @@ LPWIN32_FIND_DATAA lpFindFileData) { PKERNEL32_FIND_FILE_DATA IData; - UNICODE_STRING FileNameU; - ANSI_STRING FileName; if (hFindFile == INVALID_HANDLE_VALUE) { @@ -424,7 +447,7 @@ } IData = (PKERNEL32_FIND_FILE_DATA)hFindFile; - if (!InternalFindNextFile (hFindFile)) + if (!InternalFindNextFile (hFindFile, NULL)) { DPRINT("InternalFindNextFile() failed\n"); return FALSE; @@ -434,59 +457,8 @@ IData->pFileInfo->FileNameLength); /* copy data into WIN32_FIND_DATA structure */ - lpFindFileData->dwFileAttributes = IData->pFileInfo->FileAttributes; + InternalCopyFindDataA(lpFindFileData, IData->pFileInfo); - lpFindFileData->ftCreationTime.dwHighDateTime = IData->pFileInfo->CreationTime.u.HighPart; - lpFindFileData->ftCreationTime.dwLowDateTime = IData->pFileInfo->CreationTime.u.LowPart; - - lpFindFileData->ftLastAccessTime.dwHighDateTime = IData->pFileInfo->LastAccessTime.u.HighPart; - lpFindFileData->ftLastAccessTime.dwLowDateTime = IData->pFileInfo->LastAccessTime.u.LowPart; - - lpFindFileData->ftLastWriteTime.dwHighDateTime = IData->pFileInfo->LastWriteTime.u.HighPart; - lpFindFileData->ftLastWriteTime.dwLowDateTime = IData->pFileInfo->LastWriteTime.u.LowPart; - - lpFindFileData->nFileSizeHigh = IData->pFileInfo->EndOfFile.u.HighPart; - lpFindFileData->nFileSizeLow = IData->pFileInfo->EndOfFile.u.LowPart; - - FileNameU.Length = IData->pFileInfo->FileNameLength; - FileNameU.MaximumLength = FileNameU.Length + sizeof(WCHAR); - FileNameU.Buffer = IData->pFileInfo->FileName; - - FileName.Length = 0; - FileName.MaximumLength = MAX_PATH; - FileName.Buffer = lpFindFileData->cFileName; - - /* convert unicode string to ansi (or oem) */ - if (bIsFileApiAnsi) - RtlUnicodeStringToAnsiString (&FileName, - &FileNameU, - FALSE); - else - RtlUnicodeStringToOemString (&FileName, - &FileNameU, - FALSE); - - DPRINT("IData->pFileInfo->ShortNameLength %d\n", - IData->pFileInfo->ShortNameLength); - - FileNameU.Length = IData->pFileInfo->ShortNameLength; - FileNameU.MaximumLength = FileNameU.Length + sizeof(WCHAR); - FileNameU.Buffer = IData->pFileInfo->ShortName; - - FileName.Length = 0; - FileName.MaximumLength = 14; - FileName.Buffer = lpFindFileData->cAlternateFileName; - - /* convert unicode string to ansi (or oem) */ - if (bIsFileApiAnsi) - RtlUnicodeStringToAnsiString (&FileName, - &FileNameU, - FALSE); - else - RtlUnicodeStringToOemString (&FileName, - &FileNameU, - FALSE); - return TRUE; } @@ -529,42 +501,15 @@ LPWIN32_FIND_DATAW lpFindFileData ) { - PKERNEL32_FIND_FILE_DATA IData; - IData = InternalFindFirstFile (lpFileName); - if (IData == NULL) - { - DPRINT("Failing request\n"); - return INVALID_HANDLE_VALUE; - } - - /* copy data into WIN32_FIND_DATA structure */ - lpFindFileData->dwFileAttributes = IData->pFileInfo->FileAttributes; - - lpFindFileData->ftCreationTime.dwHighDateTime = IData->pFileInfo->CreationTime.u.HighPart; - lpFindFileData->ftCreationTime.dwLowDateTime = IData->pFileInfo->CreationTime.u.LowPart; - - lpFindFileData->ftLastAccessTime.dwHighDateTime = IData->pFileInfo->LastAccessTime.u.HighPart; - lpFindFileData->ftLastAccessTime.dwLowDateTime = IData->pFileInfo->LastAccessTime.u.LowPart; - - lpFindFileData->ftLastWriteTime.dwHighDateTime = IData->pFileInfo->LastWriteTime.u.HighPart; - lpFindFileData->ftLastWriteTime.dwLowDateTime = IData->pFileInfo->LastWriteTime.u.LowPart; - - lpFindFileData->nFileSizeHigh = IData->pFileInfo->EndOfFile.u.HighPart; - lpFindFileData->nFileSizeLow = IData->pFileInfo->EndOfFile.u.LowPart; - - memcpy (lpFindFileData->cFileName, - IData->pFileInfo->FileName, - IData->pFileInfo->FileNameLength); - lpFindFileData->cFileName[IData->pFileInfo->FileNameLength / sizeof(WCHAR)] = 0; - memcpy (lpFindFileData->cAlternateFileName, - IData->pFileInfo->ShortName, - IData->pFileInfo->ShortNameLength); - lpFindFileData->cAlternateFileName[IData->pFileInfo->ShortNameLength / sizeof(WCHAR)] = 0; - return IData; + return FindFirstFileExW (lpFileName, + FindExInfoStandard, + (LPVOID)lpFindFileData, + FindExSearchNameMatch, + NULL, + 0); } - /* * @implemented */ @@ -585,38 +530,15 @@ } IData = (PKERNEL32_FIND_FILE_DATA)hFindFile; - if (!InternalFindNextFile(hFindFile)) + if (!InternalFindNextFile(hFindFile, NULL)) { DPRINT("Failing request\n"); return FALSE; } /* copy data into WIN32_FIND_DATA structure */ - lpFindFileData->dwFileAttributes = IData->pFileInfo->FileAttributes; + InternalCopyFindDataW(lpFindFileData, IData->pFileInfo); - lpFindFileData->ftCreationTime.dwHighDateTime = IData->pFileInfo->CreationTime.u.HighPart; - lpFindFileData->ftCreationTime.dwLowDateTime = IData->pFileInfo->CreationTime.u.LowPart; - - lpFindFileData->ftLastAccessTime.dwHighDateTime = IData->pFileInfo->LastAccessTime.u.HighPart; - lpFindFileData->ftLastAccessTime.dwLowDateTime = IData->pFileInfo->LastAccessTime.u.LowPart; - - lpFindFileData->ftLastWriteTime.dwHighDateTime = IData->pFileInfo->LastWriteTime.u.HighPart; - lpFindFileData->ftLastWriteTime.dwLowDateTime = IData->pFileInfo->LastWriteTime.u.LowPart; - - lpFindFileData->nFileSizeHigh = IData->pFileInfo->EndOfFile.u.HighPart; - lpFindFileData->nFileSizeLow = IData->pFileInfo->EndOfFile.u.LowPart; - - lpFindFileData->nFileSizeHigh = IData->pFileInfo->EndOfFile.u.HighPart; - lpFindFileData->nFileSizeLow = IData->pFileInfo->EndOfFile.u.LowPart; - - memcpy (lpFindFileData->cFileName, - IData->pFileInfo->FileName, - IData->pFileInfo->FileNameLength); - lpFindFileData->cFileName[IData->pFileInfo->FileNameLength / sizeof(WCHAR)] = 0; - memcpy (lpFindFileData->cAlternateFileName, - IData->pFileInfo->ShortName, - IData->pFileInfo->ShortNameLength); - lpFindFileData->cAlternateFileName[IData->pFileInfo->ShortNameLength / sizeof(WCHAR)] = 0; return TRUE; } @@ -626,20 +548,44 @@ */ HANDLE STDCALL -FindFirstFileExW ( - LPCWSTR lpFileName, - FINDEX_INFO_LEVELS fInfoLevelId, - LPVOID lpFindFileData, - FINDEX_SEARCH_OPS fSearchOp, - LPVOID lpSearchFilter, - DWORD dwAdditionalFlags - ) +FindFirstFileExW (LPCWSTR lpFileName, + FINDEX_INFO_LEVELS fInfoLevelId, + LPVOID lpFindFileData, + FINDEX_SEARCH_OPS fSearchOp, + LPVOID lpSearchFilter, + DWORD dwAdditionalFlags) { - /* FIXME */ - return (HANDLE) 0; -} + PKERNEL32_FIND_FILE_DATA IData; + if (fInfoLevelId != FindExInfoStandard) + { + SetLastError(ERROR_INVALID_PARAMETER); + return INVALID_HANDLE_VALUE; + } + if (fSearchOp == FindExSearchNameMatch || fSearchOp == FindExSearchLimitToDirectories) + { + if (lpSearchFilter) + { + SetLastError(ERROR_INVALID_PARAMETER); + return INVALID_HANDLE_VALUE; + } + IData = InternalFindFirstFile (lpFileName, fSearchOp == FindExSearchLimitToDirectories ? TRUE : FALSE); + if (IData == NULL) + { + DPRINT("Failing request\n"); + return INVALID_HANDLE_VALUE; + } + + /* copy data into WIN32_FIND_DATA structure */ + InternalCopyFindDataW((LPWIN32_FIND_DATAW)lpFindFileData, IData->pFileInfo); + + return (HANDLE)IData; + } + SetLastError(ERROR_INVALID_PARAMETER); + return INVALID_HANDLE_VALUE; +} + /* * @unimplemented */ @@ -654,8 +600,46 @@ DWORD dwAdditionalFlags ) { - /* FIXME */ - return (HANDLE) 0; + PKERNEL32_FIND_FILE_DATA IData; + UNICODE_STRING FileNameU; + ANSI_STRING FileNameA; + + if (fInfoLevelId != FindExInfoStandard) + { + SetLastError(ERROR_INVALID_PARAMETER); + return INVALID_HANDLE_VALUE; + } + if (fSearchOp == FindExSearchNameMatch || fSearchOp == FindExSearchLimitToDirectories) + { + if (lpSearchFilter) + { + SetLastError(ERROR_INVALID_PARAMETER); + return INVALID_HANDLE_VALUE; + } + + RtlInitAnsiString (&FileNameA, (LPSTR)lpFileName); + + /* convert ansi (or oem) string to unicode */ + if (bIsFileApiAnsi) + RtlAnsiStringToUnicodeString (&FileNameU, &FileNameA, TRUE); + else + RtlOemStringToUnicodeString (&FileNameU, &FileNameA, TRUE); + + IData = InternalFindFirstFile (FileNameU.Buffer, FALSE); + + RtlFreeUnicodeString (&FileNameU); + + if (IData == NULL) + { + DPRINT("Failing request\n"); + return INVALID_HANDLE_VALUE; + } + + /* copy data into WIN32_FIND_DATA structure */ + InternalCopyFindDataA(lpFindFileData, IData->pFileInfo); + } + SetLastError(ERROR_INVALID_PARAMETER); + return INVALID_HANDLE_VALUE; }
19 years, 4 months
1
0
0
0
[gvg] 17290: Sync to Wine-20050725:
by gvg@svn.reactos.com
Sync to Wine-20050725: Francois Gouget <fgouget(a)free.fr> - Assorted spelling fixes. Gerold Jens Wucherpfennig <gjwucherpfennig(a)gmx.net> - Support for big-endian systems. - The fci_get_little_endian... and fci_set_little_endian... functions don't really set and unset little endianes, they do the same thing: merely swapping bytes from one endianes to the other. Stefan Huehner <stefan(a)huehner.org> - Make some function static. - Fix some more -Wmissing-declarations warnings. Modified: trunk/reactos/lib/cabinet/cabextract.c Modified: trunk/reactos/lib/cabinet/fci.c Modified: trunk/reactos/lib/cabinet/fdi.c _____ Modified: trunk/reactos/lib/cabinet/cabextract.c --- trunk/reactos/lib/cabinet/cabextract.c 2005-08-11 17:41:30 UTC (rev 17289) +++ trunk/reactos/lib/cabinet/cabextract.c 2005-08-11 18:49:40 UTC (rev 17290) @@ -51,7 +51,7 @@ */ /* try to open a cabinet file, returns success */ -BOOL cabinet_open(struct cabinet *cab) +static BOOL cabinet_open(struct cabinet *cab) { const char *name = cab->filename; HANDLE fh; @@ -89,7 +89,7 @@ * * close the file handle in a struct cabinet. */ -void cabinet_close(struct cabinet *cab) { +static void cabinet_close(struct cabinet *cab) { TRACE("(cab == ^%p)\n", cab); if (cab->fh) CloseHandle(cab->fh); cab->fh = 0; @@ -98,7 +98,7 @@ /******************************************************* * ensure_filepath2 (internal) */ -BOOL ensure_filepath2(char *path) { +static BOOL ensure_filepath2(char *path) { BOOL ret = TRUE; int len; char *new_path; @@ -147,7 +147,7 @@ * * ensure_filepath("a\b\c\d.txt") ensures a, a\b and a\b\c exist as dirs */ -BOOL ensure_filepath(char *path) { +static BOOL ensure_filepath(char *path) { char new_path[MAX_PATH]; int len, i, lastslashpos = -1; @@ -176,7 +176,7 @@ * * opens a file for output, returns success */ -BOOL file_open(struct cab_file *fi, BOOL lower, LPCSTR dir) +static BOOL file_open(struct cab_file *fi, BOOL lower, LPCSTR dir) { char c, *d, *name; BOOL ok = FALSE; @@ -239,7 +239,7 @@ * * closes a completed file */ -void file_close(struct cab_file *fi) +static void file_close(struct cab_file *fi) { TRACE("(fi == ^%p)\n", fi); @@ -255,7 +255,7 @@ * writes from buf to a file specified as a cab_file struct. * returns success/failure */ -BOOL file_write(struct cab_file *fi, cab_UBYTE *buf, cab_off_t length) +static BOOL file_write(struct cab_file *fi, cab_UBYTE *buf, cab_off_t length) { DWORD bytes_written; @@ -276,7 +276,7 @@ * advance the file pointer associated with the cab structure * by distance bytes */ -void cabinet_skip(struct cabinet *cab, cab_off_t distance) +static void cabinet_skip(struct cabinet *cab, cab_off_t distance) { TRACE("(cab == ^%p, distance == %u)\n", cab, distance); if (SetFilePointer(cab->fh, distance, NULL, FILE_CURRENT) == INVALID_SET_FILE_POINTER) { @@ -290,7 +290,7 @@ * * seek to the specified absolute offset in a cab */ -void cabinet_seek(struct cabinet *cab, cab_off_t offset) { +static void cabinet_seek(struct cabinet *cab, cab_off_t offset) { TRACE("(cab == ^%p, offset == %u)\n", cab, offset); if (SetFilePointer(cab->fh, offset, NULL, FILE_BEGIN) != offset) ERR("%s seek failure\n", debugstr_a(cab->filename)); @@ -301,7 +301,7 @@ * * returns the file pointer position of a cab */ -cab_off_t cabinet_getoffset(struct cabinet *cab) +static cab_off_t cabinet_getoffset(struct cabinet *cab) { return SetFilePointer(cab->fh, 0, NULL, FILE_CURRENT); } @@ -311,7 +311,7 @@ * * read data from a cabinet, returns success */ -BOOL cabinet_read(struct cabinet *cab, cab_UBYTE *buf, cab_off_t length) +static BOOL cabinet_read(struct cabinet *cab, cab_UBYTE *buf, cab_off_t length) { DWORD bytes_read; cab_off_t avail = cab->filelen - cabinet_getoffset(cab); @@ -339,7 +339,7 @@ * * allocate and read an aribitrarily long string from the cabinet */ -char *cabinet_read_string(struct cabinet *cab) +static char *cabinet_read_string(struct cabinet *cab) { cab_off_t len=256, base = cabinet_getoffset(cab), maxlen = cab->filelen - base; BOOL ok = FALSE; @@ -387,7 +387,7 @@ * * reads the header and all folder and file entries in this cabinet */ -BOOL cabinet_read_entries(struct cabinet *cab) +static BOOL cabinet_read_entries(struct cabinet *cab) { int num_folders, num_files, header_resv, folder_resv = 0, i; struct cab_folder *fol, *linkfol = NULL; @@ -525,7 +525,7 @@ * file [name]. Returns a cabinet structure if successful, or NULL * otherwise. */ -struct cabinet *load_cab_offset(LPCSTR name, cab_off_t offset) +static struct cabinet *load_cab_offset(LPCSTR name, cab_off_t offset) { struct cabinet *cab = (struct cabinet *) calloc(1, sizeof(struct cabinet)); int ok; @@ -553,7 +553,7 @@ /******************************************************** * Ziphuft_free (internal) */ -void Ziphuft_free(struct Ziphuft *t) +static void Ziphuft_free(struct Ziphuft *t) { register struct Ziphuft *p, *q; @@ -570,7 +570,7 @@ /********************************************************* * Ziphuft_build (internal) */ -cab_LONG Ziphuft_build(cab_ULONG *b, cab_ULONG n, cab_ULONG s, cab_UWORD *d, cab_UWORD *e, +static cab_LONG Ziphuft_build(cab_ULONG *b, cab_ULONG n, cab_ULONG s, cab_UWORD *d, cab_UWORD *e, struct Ziphuft **t, cab_LONG *m, cab_decomp_state *decomp_state) { cab_ULONG a; /* counter for codes of length k */ @@ -750,7 +750,7 @@ /********************************************************* * Zipinflate_codes (internal) */ -cab_LONG Zipinflate_codes(struct Ziphuft *tl, struct Ziphuft *td, +static cab_LONG Zipinflate_codes(struct Ziphuft *tl, struct Ziphuft *td, cab_LONG bl, cab_LONG bd, cab_decomp_state *decomp_state) { register cab_ULONG e; /* table entry flag/number of extra bits */ @@ -833,7 +833,7 @@ /*********************************************************** * Zipinflate_stored (internal) */ -cab_LONG Zipinflate_stored(cab_decomp_state *decomp_state) +static cab_LONG Zipinflate_stored(cab_decomp_state *decomp_state) /* "decompress" an inflated type 0 (stored) block. */ { cab_ULONG n; /* number of bytes in block */ @@ -877,7 +877,7 @@ /****************************************************** * Zipinflate_fixed (internal) */ -cab_LONG Zipinflate_fixed(cab_decomp_state *decomp_state) +static cab_LONG Zipinflate_fixed(cab_decomp_state *decomp_state) { struct Ziphuft *fixed_tl; struct Ziphuft *fixed_td; @@ -923,7 +923,7 @@ /************************************************************** * Zipinflate_dynamic (internal) */ -cab_LONG Zipinflate_dynamic(cab_decomp_state *decomp_state) +static cab_LONG Zipinflate_dynamic(cab_decomp_state *decomp_state) /* decompress an inflated type 2 (dynamic Huffman codes) block. */ { cab_LONG i; /* temporary variables */ @@ -1058,7 +1058,7 @@ /***************************************************** * Zipinflate_block (internal) */ -cab_LONG Zipinflate_block(cab_LONG *e, cab_decomp_state *decomp_state) /* e == last block flag */ +static cab_LONG Zipinflate_block(cab_LONG *e, cab_decomp_state *decomp_state) /* e == last block flag */ { /* decompress an inflated block */ cab_ULONG t; /* block type */ register cab_ULONG b; /* bit buffer */ @@ -1096,7 +1096,7 @@ /**************************************************** * ZIPdecompress (internal) */ -int ZIPdecompress(int inlen, int outlen, cab_decomp_state *decomp_state) +static int ZIPdecompress(int inlen, int outlen, cab_decomp_state *decomp_state) { cab_LONG e; /* last block flag */ @@ -1132,7 +1132,7 @@ * * Initialise a model which decodes symbols from [s] to [s]+[n]-1 */ -void QTMinitmodel(struct QTMmodel *m, struct QTMmodelsym *sym, int n, int s) { +static void QTMinitmodel(struct QTMmodel *m, struct QTMmodelsym *sym, int n, int s) { int i; m->shiftsleft = 4; m->entries = n; @@ -1149,7 +1149,7 @@ /****************************************************************** * QTMinit (internal) */ -int QTMinit(int window, int level, cab_decomp_state *decomp_state) { +static int QTMinit(int window, int level, cab_decomp_state *decomp_state) { unsigned int wndsize = 1 << window; int msz = window * 2, i; cab_ULONG j; @@ -1256,7 +1256,7 @@ /******************************************************************* * QTMdecompress (internal) */ -int QTMdecompress(int inlen, int outlen, cab_decomp_state *decomp_state) +static int QTMdecompress(int inlen, int outlen, cab_decomp_state *decomp_state) { cab_UBYTE *inpos = CAB(inbuf); cab_UBYTE *window = QTM(window); @@ -1438,7 +1438,7 @@ /************************************************************ * LZXinit (internal) */ -int LZXinit(int window, cab_decomp_state *decomp_state) { +static int LZXinit(int window, cab_decomp_state *decomp_state) { cab_ULONG wndsize = 1 << window; int i, j, posn_slots; @@ -1579,7 +1579,7 @@ /************************************************************ * lzx_read_lens (internal) */ -int lzx_read_lens(cab_UBYTE *lens, cab_ULONG first, cab_ULONG last, struct lzx_bits *lb, +static int lzx_read_lens(cab_UBYTE *lens, cab_ULONG first, cab_ULONG last, struct lzx_bits *lb, cab_decomp_state *decomp_state) { cab_ULONG i,j, x,y; int z; @@ -1626,7 +1626,7 @@ /******************************************************* * LZXdecompress (internal) */ -int LZXdecompress(int inlen, int outlen, cab_decomp_state *decomp_state) { +static int LZXdecompress(int inlen, int outlen, cab_decomp_state *decomp_state) { cab_UBYTE *inpos = CAB(inbuf); cab_UBYTE *endinp = inpos + inlen; cab_UBYTE *window = LZX(window); @@ -1949,7 +1949,7 @@ /********************************************************* * find_cabs_in_file (internal) */ -struct cabinet *find_cabs_in_file(LPCSTR name, cab_UBYTE search_buf[]) +static struct cabinet *find_cabs_in_file(LPCSTR name, cab_UBYTE search_buf[]) { struct cabinet *cab, *cab2, *firstcab = NULL, *linkcab = NULL; cab_UBYTE *pstart = &search_buf[0], *pend, *p; @@ -2067,7 +2067,7 @@ * tries to find *cabname, from the directory path of origcab, correcting the * case of *cabname if necessary, If found, writes back to *cabname. */ -void find_cabinet_file(char **cabname, LPCSTR origcab) { +static void find_cabinet_file(char **cabname, LPCSTR origcab) { char *tail, *cab, *name, *nextpart, nametmp[MAX_PATH]; int found = 0; @@ -2156,7 +2156,7 @@ * in CAB.c) for an implementation of this that correctly frees the discarded * file entries. */ -struct cab_file *process_files(struct cabinet *basecab) { +static struct cab_file *process_files(struct cabinet *basecab) { struct cabinet *cab; struct cab_file *outfi = NULL, *linkfi = NULL, *nextfi, *fi, *cfi; struct cab_folder *fol, *firstfol, *lastfol = NULL, *predfol; @@ -2259,7 +2259,7 @@ * * FIXME: use a winapi to do this */ -int convertUTF(cab_UBYTE *in) { +static int convertUTF(cab_UBYTE *in) { cab_UBYTE c, *out = in, *end = in + strlen((char *) in) + 1; cab_ULONG x; @@ -2291,7 +2291,7 @@ /**************************************************** * NONEdecompress (internal) */ -int NONEdecompress(int inlen, int outlen, cab_decomp_state *decomp_state) +static int NONEdecompress(int inlen, int outlen, cab_decomp_state *decomp_state) { if (inlen != outlen) return DECR_ILLEGALDATA; memcpy(CAB(outbuf), CAB(inbuf), (size_t) inlen); @@ -2322,7 +2322,7 @@ /********************************************************** * decompress (internal) */ -int decompress(struct cab_file *fi, int savemode, int fix, cab_decomp_state *decomp_state) +static int decompress(struct cab_file *fi, int savemode, int fix, cab_decomp_state *decomp_state) { cab_ULONG bytes = savemode ? fi->length : fi->offset - CAB(offset); struct cabinet *cab = CAB(current)->cab[CAB(split)]; @@ -2412,7 +2412,7 @@ * * workhorse to extract a particular file from a cab */ -void extract_file(struct cab_file *fi, int lower, int fix, LPCSTR dir, cab_decomp_state *decomp_state) +static void extract_file(struct cab_file *fi, int lower, int fix, LPCSTR dir, cab_decomp_state *decomp_state) { struct cab_folder *fol = fi->folder, *oldfol = CAB(current); cab_LONG err = DECR_OK; @@ -2523,7 +2523,7 @@ /********************************************************* * print_fileinfo (internal) */ -void print_fileinfo(struct cab_file *fi) { +static void print_fileinfo(struct cab_file *fi) { char *fname = NULL; if (fi->attribs & cffile_A_NAME_IS_UTF) { _____ Modified: trunk/reactos/lib/cabinet/fci.c --- trunk/reactos/lib/cabinet/fci.c 2005-08-11 17:41:30 UTC (rev 17289) +++ trunk/reactos/lib/cabinet/fci.c 2005-08-11 18:49:40 UTC (rev 17290) @@ -23,7 +23,6 @@ There is still some work to be done: -- currently no support for big-endian machines - the ERF error structure aren't used on error - no real compression yet - unknown behaviour if files>4GB or cabinet >4GB @@ -44,11 +43,22 @@ #include "windef.h" #include "winbase.h" #include "winerror.h" +#include "winternl.h" #include "fci.h" #include "cabinet.h" #include "wine/debug.h" + +#ifdef WORDS_BIGENDIAN +#define fci_endian_ulong(x) RtlUlongByteSwap(x) +#define fci_endian_uword(x) RtlUshortByteSwap(x) +#else +#define fci_endian_ulong(x) (x) +#define fci_endian_uword(x) (x) +#endif + + WINE_DEFAULT_DEBUG_CHANNEL(cabinet); typedef struct { @@ -556,7 +566,7 @@ read_result=pcfdata->cbData; /* Modify the size of the compressed data to store only a part of the */ /* data block into the current cabinet. This is done to prevent */ - /* that the maximum cabinet size will be exceeded. The remainer */ + /* that the maximum cabinet size will be exceeded. The remainder */ /* will be stored into the next following cabinet. */ /* The cabinet will be of size "p_fci_internal->oldCCAB.cb". */ @@ -599,12 +609,19 @@ return FALSE; } + /* set little endian */ + pcfdata->cbData=fci_endian_uword(pcfdata->cbData); + pcfdata->cbUncomp=fci_endian_uword(pcfdata->cbUncomp); + /* get checksum and write to cfdata.csum */ pcfdata->csum = fci_get_checksum( &(pcfdata->cbData), sizeof(CFDATA)+cbReserveCFData - sizeof(pcfdata->csum), fci_get_checksum( p_fci_internal->data_out, /*buffer*/ pcfdata->cbData, 0 ) ); + /* set little endian */ + pcfdata->csum=fci_endian_ulong(pcfdata->csum); + /* write cfdata with checksum to p_fci_internal->handleCFDATA2 */ if( PFCI_WRITE(hfci, p_fci_internal->handleCFDATA2, /* file handle */ buffer, /* memory buffer */ @@ -617,6 +634,11 @@ p_fci_internal->sizeFileCFDATA2 += sizeof(CFDATA)+cbReserveCFData; + /* reset little endian */ + pcfdata->cbData=fci_endian_uword(pcfdata->cbData); + pcfdata->cbUncomp=fci_endian_uword(pcfdata->cbUncomp); + pcfdata->csum=fci_endian_ulong(pcfdata->csum); + /* write compressed data into p_fci_internal->handleCFDATA2 */ if( PFCI_WRITE(hfci, p_fci_internal->handleCFDATA2, /* file handle */ p_fci_internal->data_out, /* memory buffer */ @@ -632,7 +654,7 @@ p_fci_internal->statusFolderCopied += pcfdata->cbData; (*payload)+=pcfdata->cbUncomp; /* if cabinet size too large and data has been split */ - /* write the remainer of the data block to the new CFDATA1 file */ + /* write the remainder of the data block to the new CFDATA1 file */ if( split_block ) { /* This does not include the */ /* abused one (just search for "abused" )*/ /* copy all CFDATA structures from handleCFDATA1 to handleCFDATA1new */ @@ -641,7 +663,7 @@ return FALSE; } - /* set cbData the size of the remainer of the data block */ + /* set cbData to the size of the remainder of the data block */ pcfdata->cbData = read_result - pcfdata->cbData; /*recover former value of cfdata.cbData; read_result will be the offset*/ read_result -= pcfdata->cbData; @@ -649,6 +671,7 @@ /* reset checksum, it will be computed later */ pcfdata->csum=0; + /* write cfdata WITHOUT checksum to handleCFDATA1new */ if( PFCI_WRITE(hfci, handleCFDATA1new, /* file handle */ buffer, /* memory buffer */ @@ -657,7 +680,7 @@ /* TODO write error */ return FALSE; } - /* TODO error handling of err dont forget PFCI_FREE(hfci, reserved) */ + /* TODO error handling of err don't forget PFCI_FREE(hfci, reserved) */ *psizeFileCFDATA1new += sizeof(CFDATA)+cbReserveCFData; @@ -676,7 +699,7 @@ *psizeFileCFDATA1new += pcfdata->cbData; /* the two blocks of the split data block have been written */ - /* dont reset split_data yet, because it is still needed see below */ + /* don't reset split_data yet, because it is still needed see below */ } /* report status with pfnfcis about copied size of folder */ @@ -721,7 +744,7 @@ /* TODO read error */ return FALSE; } - /* TODO error handling of err dont forget PFCI_FREE(hfci, reserved) */ + /* TODO error handling of err don't forget PFCI_FREE(hfci, reserved) */ /* write cfdata with checksum to handleCFDATA1new */ if( PFCI_WRITE(hfci, handleCFDATA1new, /* file handle */ @@ -731,7 +754,7 @@ /* TODO write error */ return FALSE; } - /* TODO error handling of err dont forget PFCI_FREE(hfci, reserved) */ + /* TODO error handling of err don't forget PFCI_FREE(hfci, reserved) */ *psizeFileCFDATA1new += sizeof(CFDATA)+cbReserveCFData; @@ -779,7 +802,7 @@ /* absolute offset cannot be set yet, because the size of cabinet header, */ /* the number of CFFOLDERs and the number of CFFILEs may change. */ /* Instead the size of all previous data blocks will be stored and */ - /* the remainer of the offset will be added when the cabinet will be */ + /* the remainder of the offset will be added when the cabinet will be */ /* flushed to disk. */ /* This is exactly the way the original CABINET.DLL works!!! */ cffolder.coffCabStart=sizeFileCFDATA2old; @@ -965,6 +988,14 @@ cffile.iFolder=cffileCONTINUED_TO_NEXT; } + /* set little endian */ + cffile.cbFile=fci_endian_ulong(cffile.cbFile); + cffile.uoffFolderStart=fci_endian_ulong(cffile.uoffFolderStart); + cffile.iFolder=fci_endian_uword(cffile.iFolder); + cffile.date=fci_endian_uword(cffile.date); + cffile.time=fci_endian_uword(cffile.time); + cffile.attribs=fci_endian_uword(cffile.attribs); + /* write cffile to p_fci_internal->handleCFFILE2 */ if( PFCI_WRITE(hfci, p_fci_internal->handleCFFILE2, /* file handle */ &cffile, /* memory buffer */ @@ -977,6 +1008,14 @@ p_fci_internal->sizeFileCFFILE2 += sizeof(cffile); + /* reset little endian */ + cffile.cbFile=fci_endian_ulong(cffile.cbFile); + cffile.uoffFolderStart=fci_endian_ulong(cffile.uoffFolderStart); + cffile.iFolder=fci_endian_uword(cffile.iFolder); + cffile.date=fci_endian_uword(cffile.date); + cffile.time=fci_endian_uword(cffile.time); + cffile.attribs=fci_endian_uword(cffile.attribs); + /* write file name to p_fci_internal->handleCFFILE2 */ if( PFCI_WRITE(hfci, p_fci_internal->handleCFFILE2, /* file handle */ p_fci_internal->data_out, /* memory buffer */ @@ -1580,6 +1619,18 @@ cfheader.iCabinet = p_fci_internal->pccab->iCab-1; } + /* set little endian */ + cfheader.reserved1=fci_endian_ulong(cfheader.reserved1); + cfheader.cbCabinet=fci_endian_ulong(cfheader.cbCabinet); + cfheader.reserved2=fci_endian_ulong(cfheader.reserved2); + cfheader.coffFiles=fci_endian_ulong(cfheader.coffFiles); + cfheader.reserved3=fci_endian_ulong(cfheader.reserved3); + cfheader.cFolders=fci_endian_uword(cfheader.cFolders); + cfheader.cFiles=fci_endian_uword(cfheader.cFiles); + cfheader.flags=fci_endian_uword(cfheader.flags); + cfheader.setID=fci_endian_uword(cfheader.setID); + cfheader.iCabinet=fci_endian_uword(cfheader.iCabinet); + /* write CFHEADER into cabinet file */ if( PFCI_WRITE(hfci, handleCABINET, /* file handle */ &cfheader, /* memory buffer */ @@ -1590,6 +1641,18 @@ } /* TODO error handling of err */ + /* reset little endian */ + cfheader.reserved1=fci_endian_ulong(cfheader.reserved1); + cfheader.cbCabinet=fci_endian_ulong(cfheader.cbCabinet); + cfheader.reserved2=fci_endian_ulong(cfheader.reserved2); + cfheader.coffFiles=fci_endian_ulong(cfheader.coffFiles); + cfheader.reserved3=fci_endian_ulong(cfheader.reserved3); + cfheader.cFolders=fci_endian_uword(cfheader.cFolders); + cfheader.cFiles=fci_endian_uword(cfheader.cFiles); + cfheader.flags=fci_endian_uword(cfheader.flags); + cfheader.setID=fci_endian_uword(cfheader.setID); + cfheader.iCabinet=fci_endian_uword(cfheader.iCabinet); + if( cfheader.flags & cfheadRESERVE_PRESENT ) { /* NOTE: No checks for maximum value overflows as designed by MS!!! */ cfreserved.cbCFHeader = cbReserveCFHeader; @@ -1600,6 +1663,10 @@ } else { cfreserved.cbCFData = p_fci_internal->pccab->cbReserveCFData; } + + /* set little endian */ + cfreserved.cbCFHeader=fci_endian_uword(cfreserved.cbCFHeader); + /* write reserved info into cabinet file */ if( PFCI_WRITE(hfci, handleCABINET, /* file handle */ &cfreserved, /* memory buffer */ @@ -1609,6 +1676,9 @@ return FALSE; } /* TODO error handling of err */ + + /* reset little endian */ + cfreserved.cbCFHeader=fci_endian_uword(cfreserved.cbCFHeader); } /* add optional reserved area */ @@ -1735,6 +1805,11 @@ } } + /* set little endian */ + cffolder.coffCabStart=fci_endian_ulong(cffolder.coffCabStart); + cffolder.cCFData=fci_endian_uword(cffolder.cCFData); + cffolder.typeCompress=fci_endian_uword(cffolder.typeCompress); + /* write cffolder to cabinet file */ if( PFCI_WRITE(hfci, handleCABINET, /* file handle */ &cffolder, /* memory buffer */ @@ -1745,6 +1820,11 @@ } /* TODO error handling of err */ + /* reset little endian */ + cffolder.coffCabStart=fci_endian_ulong(cffolder.coffCabStart); + cffolder.cCFData=fci_endian_uword(cffolder.cCFData); + cffolder.typeCompress=fci_endian_uword(cffolder.typeCompress); + /* add optional reserved area */ /* This allocation and freeing at each CFFolder block is a bit */ _____ Modified: trunk/reactos/lib/cabinet/fdi.c --- trunk/reactos/lib/cabinet/fdi.c 2005-08-11 17:41:30 UTC (rev 17289) +++ trunk/reactos/lib/cabinet/fdi.c 2005-08-11 18:49:40 UTC (rev 17290) @@ -243,7 +243,7 @@ * * returns the file pointer position of a file handle. */ -long FDI_getoffset(HFDI hfdi, INT_PTR hf) +static long FDI_getoffset(HFDI hfdi, INT_PTR hf) { return PFDI_SEEK(hfdi, hf, 0L, SEEK_CUR); } @@ -254,7 +254,7 @@ * we can't use _msize; the user might not be using malloc, so we require * an explicit specification of the previous size. inefficient. */ -void *FDI_realloc(HFDI hfdi, void *mem, size_t prevsize, size_t newsize) +static void *FDI_realloc(HFDI hfdi, void *mem, size_t prevsize, size_t newsize) { void *rslt = NULL; char *irslt, *imem; @@ -273,7 +273,7 @@ * * allocate and read an arbitrarily long string from the cabinet */ -char *FDI_read_string(HFDI hfdi, INT_PTR hf, long cabsize) +static char *FDI_read_string(HFDI hfdi, INT_PTR hf, long cabsize) { size_t len=256, oldlen = 0, @@ -326,7 +326,7 @@ * process the cabinet header in the style of FDIIsCabinet, but * without the sanity checks (and bug) */ -BOOL FDI_read_entries( +static BOOL FDI_read_entries( HFDI hfdi, INT_PTR hf, PFDICABINETINFO pfdici, @@ -632,7 +632,7 @@ * * Initialize a model which decodes symbols from [s] to [s]+[n]-1 */ -void QTMfdi_initmodel(struct QTMmodel *m, struct QTMmodelsym *sym, int n, int s) { +static void QTMfdi_initmodel(struct QTMmodel *m, struct QTMmodelsym *sym, int n, int s) { int i; m->shiftsleft = 4; m->entries = n; @@ -649,7 +649,7 @@ /****************************************************************** * QTMfdi_init (internal) */ -int QTMfdi_init(int window, int level, fdi_decomp_state *decomp_state) { +static int QTMfdi_init(int window, int level, fdi_decomp_state *decomp_state) { unsigned int wndsize = 1 << window; int msz = window * 2, i; cab_ULONG j; @@ -701,7 +701,7 @@ /************************************************************ * LZXfdi_init (internal) */ -int LZXfdi_init(int window, fdi_decomp_state *decomp_state) { +static int LZXfdi_init(int window, fdi_decomp_state *decomp_state) { cab_ULONG wndsize = 1 << window; int i, j, posn_slots; @@ -755,7 +755,7 @@ /**************************************************** * NONEfdi_decomp(internal) */ -int NONEfdi_decomp(int inlen, int outlen, fdi_decomp_state *decomp_state) +static int NONEfdi_decomp(int inlen, int outlen, fdi_decomp_state *decomp_state) { if (inlen != outlen) return DECR_ILLEGALDATA; memcpy(CAB(outbuf), CAB(inbuf), (size_t) inlen); @@ -765,7 +765,7 @@ /******************************************************** * Ziphuft_free (internal) */ -void fdi_Ziphuft_free(HFDI hfdi, struct Ziphuft *t) +static void fdi_Ziphuft_free(HFDI hfdi, struct Ziphuft *t) { register struct Ziphuft *p, *q; @@ -782,7 +782,7 @@ /********************************************************* * fdi_Ziphuft_build (internal) */ -cab_LONG fdi_Ziphuft_build(cab_ULONG *b, cab_ULONG n, cab_ULONG s, cab_UWORD *d, cab_UWORD *e, +static cab_LONG fdi_Ziphuft_build(cab_ULONG *b, cab_ULONG n, cab_ULONG s, cab_UWORD *d, cab_UWORD *e, struct Ziphuft **t, cab_LONG *m, fdi_decomp_state *decomp_state) { cab_ULONG a; /* counter for codes of length k */ @@ -1045,7 +1045,7 @@ /*********************************************************** * Zipinflate_stored (internal) */ -cab_LONG fdi_Zipinflate_stored(fdi_decomp_state *decomp_state) +static cab_LONG fdi_Zipinflate_stored(fdi_decomp_state *decomp_state) /* "decompress" an inflated type 0 (stored) block. */ { cab_ULONG n; /* number of bytes in block */ @@ -1089,7 +1089,7 @@ /****************************************************** * fdi_Zipinflate_fixed (internal) */ -cab_LONG fdi_Zipinflate_fixed(fdi_decomp_state *decomp_state) +static cab_LONG fdi_Zipinflate_fixed(fdi_decomp_state *decomp_state) { struct Ziphuft *fixed_tl; struct Ziphuft *fixed_td; @@ -1135,7 +1135,7 @@ /************************************************************** * fdi_Zipinflate_dynamic (internal) */ -cab_LONG fdi_Zipinflate_dynamic(fdi_decomp_state *decomp_state) +static cab_LONG fdi_Zipinflate_dynamic(fdi_decomp_state *decomp_state) /* decompress an inflated type 2 (dynamic Huffman codes) block. */ { cab_LONG i; /* temporary variables */ @@ -1270,7 +1270,7 @@ /***************************************************** * fdi_Zipinflate_block (internal) */ -cab_LONG fdi_Zipinflate_block(cab_LONG *e, fdi_decomp_state *decomp_state) /* e == last block flag */ +static cab_LONG fdi_Zipinflate_block(cab_LONG *e, fdi_decomp_state *decomp_state) /* e == last block flag */ { /* decompress an inflated block */ cab_ULONG t; /* block type */ register cab_ULONG b; /* bit buffer */ @@ -1308,7 +1308,7 @@ /**************************************************** * ZIPfdi_decomp(internal) */ -int ZIPfdi_decomp(int inlen, int outlen, fdi_decomp_state *decomp_state) +static int ZIPfdi_decomp(int inlen, int outlen, fdi_decomp_state *decomp_state) { cab_LONG e; /* last block flag */ @@ -1336,7 +1336,7 @@ /******************************************************************* * QTMfdi_decomp(internal) */ -int QTMfdi_decomp(int inlen, int outlen, fdi_decomp_state *decomp_state) +static int QTMfdi_decomp(int inlen, int outlen, fdi_decomp_state *decomp_state) { cab_UBYTE *inpos = CAB(inbuf); cab_UBYTE *window = QTM(window); @@ -1462,7 +1462,7 @@ /************************************************************ * fdi_lzx_read_lens (internal) */ -int fdi_lzx_read_lens(cab_UBYTE *lens, cab_ULONG first, cab_ULONG last, struct lzx_bits *lb, +static int fdi_lzx_read_lens(cab_UBYTE *lens, cab_ULONG first, cab_ULONG last, struct lzx_bits *lb, fdi_decomp_state *decomp_state) { cab_ULONG i,j, x,y; int z; @@ -1509,7 +1509,7 @@ /******************************************************* * LZXfdi_decomp(internal) */ -int LZXfdi_decomp(int inlen, int outlen, fdi_decomp_state *decomp_state) { +static int LZXfdi_decomp(int inlen, int outlen, fdi_decomp_state *decomp_state) { cab_UBYTE *inpos = CAB(inbuf); cab_UBYTE *endinp = inpos + inlen; cab_UBYTE *window = LZX(window); @@ -1841,7 +1841,7 @@ * is also where we jump to additional cabinets in the case of split * cab's, and provide (some of) the NEXT_CABINET notification semantics. */ -int fdi_decomp(struct fdi_file *fi, int savemode, fdi_decomp_state *decomp_state, +static int fdi_decomp(struct fdi_file *fi, int savemode, fdi_decomp_state *decomp_state, char *pszCabPath, PFNFDINOTIFY pfnfdin, void *pvUser) { cab_ULONG bytes = savemode ? fi->length : fi->offset - CAB(offset);
19 years, 4 months
1
0
0
0
[chorns] 17289: Ignore .svn folders
by chorns@svn.reactos.com
Ignore .svn folders Modified: trunk/reactos/apps/utils/stats/stats.c _____ Modified: trunk/reactos/apps/utils/stats/stats.c --- trunk/reactos/apps/utils/stats/stats.c 2005-08-11 17:27:13 UTC (rev 17288) +++ trunk/reactos/apps/utils/stats/stats.c 2005-08-11 17:41:30 UTC (rev 17289) @@ -384,7 +384,8 @@ if ((FindFile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && (_tcscmp (FindFile.cFileName, _T(".")) != 0) && (_tcscmp (FindFile.cFileName, _T("..")) != 0) - && (_tcscmp (FindFile.cFileName, _T("CVS")) != 0)) + && (_tcscmp (FindFile.cFileName, _T("CVS")) != 0) + && (_tcscmp (FindFile.cFileName, _T(".svn")) != 0)) { _tcscpy (SearchPath, Path); _tcscat (SearchPath, _T("\\"));
19 years, 4 months
1
0
0
0
← Newer
1
...
28
29
30
31
32
33
34
...
67
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Results per page:
10
25
50
100
200