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
2024
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
May 2005
----- 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
26 participants
814 discussions
Start a n
N
ew thread
[hpoussin] 15008: Change ExFreePool to ExFreePoolWithTag
by hpoussin@svn.reactos.com
Change ExFreePool to ExFreePoolWithTag Don't call RtlFreeUnicodeString if the string wasn't created by RtlAnsiStringToUnicodeString or RtlUpcaseUnicodeString Implement ExRosQueryNonPagedPoolTag Add BAD_POOL_CALLER code Modified: trunk/reactos/ntoskrnl/cm/regobj.c Modified: trunk/reactos/ntoskrnl/io/device.c Modified: trunk/reactos/ntoskrnl/io/irp.c Modified: trunk/reactos/ntoskrnl/io/mdl.c Modified: trunk/reactos/ntoskrnl/mm/marea.c Modified: trunk/reactos/ntoskrnl/mm/mdl.c Modified: trunk/reactos/ntoskrnl/mm/npool.c Modified: trunk/reactos/ntoskrnl/ntoskrnl.mc Modified: trunk/reactos/ntoskrnl/ob/object.c _____ Modified: trunk/reactos/ntoskrnl/cm/regobj.c --- trunk/reactos/ntoskrnl/cm/regobj.c 2005-05-05 16:16:28 UTC (rev 15007) +++ trunk/reactos/ntoskrnl/cm/regobj.c 2005-05-05 17:20:10 UTC (rev 15008) @@ -91,7 +91,7 @@ { ExReleaseResourceLite(&CmiRegistryLock); KeLeaveCriticalRegion(); - RtlFreeUnicodeString(&KeyName); + ExFreePool(KeyName.Buffer); return Status; } if (FoundObject == NULL) @@ -107,7 +107,7 @@ { ExReleaseResourceLite(&CmiRegistryLock); KeLeaveCriticalRegion(); - RtlFreeUnicodeString(&KeyName); + ExFreePool(KeyName.Buffer); return(STATUS_UNSUCCESSFUL); } @@ -140,7 +140,7 @@ wcscat(TargetPath.Buffer, EndPtr); } - RtlFreeUnicodeString(FullPath); + ExFreePool(FullPath->Buffer); RtlFreeUnicodeString(&LinkPath); FullPath->Length = TargetPath.Length; FullPath->MaximumLength = TargetPath.MaximumLength; @@ -153,7 +153,7 @@ *NextObject = NULL; - RtlFreeUnicodeString(&KeyName); + ExFreePool(KeyName.Buffer); return(STATUS_REPARSE); } } @@ -173,7 +173,7 @@ { ExReleaseResourceLite(&CmiRegistryLock); KeLeaveCriticalRegion(); - RtlFreeUnicodeString(&KeyName); + ExFreePool(KeyName.Buffer); return(Status); } /* Add the keep-alive reference */ @@ -224,8 +224,8 @@ wcscat(TargetPath.Buffer, EndPtr); } - RtlFreeUnicodeString(FullPath); - RtlFreeUnicodeString(&LinkPath); + ExFreePool(FullPath->Buffer); + ExFreePool(LinkPath.Buffer); FullPath->Length = TargetPath.Length; FullPath->MaximumLength = TargetPath.MaximumLength; FullPath->Buffer = TargetPath.Buffer; @@ -237,7 +237,7 @@ *NextObject = NULL; - RtlFreeUnicodeString(&KeyName); + ExFreePool(KeyName.Buffer); return(STATUS_REPARSE); } } @@ -258,7 +258,7 @@ *NextObject = FoundObject; - RtlFreeUnicodeString(&KeyName); + ExFreePool(KeyName.Buffer); return(STATUS_SUCCESS); } _____ Modified: trunk/reactos/ntoskrnl/io/device.c --- trunk/reactos/ntoskrnl/io/device.c 2005-05-05 16:16:28 UTC (rev 15007) +++ trunk/reactos/ntoskrnl/io/device.c 2005-05-05 17:20:10 UTC (rev 15008) @@ -18,6 +18,7 @@ #define TAG_DEVICE_EXTENSION TAG('D', 'E', 'X', 'T') #define TAG_SHUTDOWN_ENTRY TAG('S', 'H', 'U', 'T') +#define TAG_IO_TIMER TAG('I', 'O', 'T', 'M') static ULONG IopDeviceObjectNumber = 0; @@ -589,7 +590,7 @@ if (DeviceObject->Timer) { IopRemoveTimerFromTimerList(DeviceObject->Timer); - ExFreePool(DeviceObject->Timer); + ExFreePoolWithTag(DeviceObject->Timer, TAG_IO_TIMER); } /* Remove device from driver device list */ _____ Modified: trunk/reactos/ntoskrnl/io/irp.c --- trunk/reactos/ntoskrnl/io/irp.c 2005-05-05 16:16:28 UTC (rev 15007) +++ trunk/reactos/ntoskrnl/io/irp.c 2005-05-05 17:20:10 UTC (rev 15008) @@ -871,7 +871,7 @@ IoFreeIrp(PIRP Irp) { /* Free the pool memory associated with it */ - ExFreePool(Irp); + ExFreePoolWithTag(Irp, TAG_IRP); } /* @@ -1253,7 +1253,7 @@ /* Also check if we should de-allocate it */ if (Irp->Flags & IRP_DEALLOCATE_BUFFER) { - ExFreePool(Irp->AssociatedIrp.SystemBuffer); + ExFreePoolWithTag(Irp->AssociatedIrp.SystemBuffer, TAG_SYS_BUF); } } _____ Modified: trunk/reactos/ntoskrnl/io/mdl.c --- trunk/reactos/ntoskrnl/io/mdl.c 2005-05-05 16:16:28 UTC (rev 15007) +++ trunk/reactos/ntoskrnl/io/mdl.c 2005-05-05 17:20:10 UTC (rev 15008) @@ -132,7 +132,7 @@ MmPrepareMdlForReuse(Mdl); - ExFreePool(Mdl); + ExFreePoolWithTag(Mdl, TAG_MDL); } _____ Modified: trunk/reactos/ntoskrnl/mm/marea.c --- trunk/reactos/ntoskrnl/mm/marea.c 2005-05-05 16:16:28 UTC (rev 15007) +++ trunk/reactos/ntoskrnl/mm/marea.c 2005-05-05 17:20:10 UTC (rev 15008) @@ -812,7 +812,7 @@ } } - ExFreePool(MemoryArea); + ExFreePoolWithTag(MemoryArea, TAG_MAREA); DPRINT("MmFreeMemoryAreaByNode() succeeded\n"); _____ Modified: trunk/reactos/ntoskrnl/mm/mdl.c --- trunk/reactos/ntoskrnl/mm/mdl.c 2005-05-05 16:16:28 UTC (rev 15007) +++ trunk/reactos/ntoskrnl/mm/mdl.c 2005-05-05 17:20:10 UTC (rev 15008) @@ -16,7 +16,7 @@ /* GLOBALS *******************************************************************/ -#define TAG_MDL TAG('M', 'M', 'D', 'L') +#define TAG_MDL TAG('M', 'D', 'L', ' ') #define MI_MDL_MAPPING_REGION_SIZE (256*1024*1024) _____ Modified: trunk/reactos/ntoskrnl/mm/npool.c --- trunk/reactos/ntoskrnl/mm/npool.c 2005-05-05 16:16:28 UTC (rev 15007) +++ trunk/reactos/ntoskrnl/mm/npool.c 2005-05-05 17:20:10 UTC (rev 15008) @@ -1458,6 +1458,28 @@ #endif /* not WHOLE_PAGE_ALLOCATIONS */ +ULONG STDCALL +ExRosQueryNonPagedPoolTag ( PVOID Addr ) +{ +#ifdef WHOLE_PAGE_ALLOCATIONS /* WHOLE_PAGE_ALLOCATIONS */ + + UNIMPLEMENTED; + return 0; + +#else /* not WHOLE_PAGE_ALLOCATIONS */ + + BLOCK_HDR* blk=address_to_block(Addr); + + if (blk->Magic != BLOCK_HDR_USED_MAGIC) + KEBUGCHECK(0); + if (blk->Magic == BLOCK_HDR_FREE_MAGIC) + KEBUGCHECK(0); + + return blk->Used.Tag; + +#endif /* WHOLE_PAGE_ALLOCATIONS */ +} + VOID STDCALL ExFreeNonPagedPool (PVOID block) /* * FUNCTION: Releases previously allocated memory _____ Modified: trunk/reactos/ntoskrnl/ntoskrnl.mc --- trunk/reactos/ntoskrnl/ntoskrnl.mc 2005-05-05 16:16:28 UTC (rev 15007) +++ trunk/reactos/ntoskrnl/ntoskrnl.mc 2005-05-05 17:20:10 UTC (rev 15008) @@ -987,6 +987,14 @@ INVALID_WORK_QUEUE_ITEM . +MessageId=0xC2 +Severity=Success +Facility=System +SymbolicName=BAD_POOL_CALLER +Language=English +BAD_POOL_CALLER +. + MessageId=0xE1 Severity=Success Facility=System _____ Modified: trunk/reactos/ntoskrnl/ob/object.c --- trunk/reactos/ntoskrnl/ob/object.c 2005-05-05 16:16:28 UTC (rev 15007) +++ trunk/reactos/ntoskrnl/ob/object.c 2005-05-05 17:20:10 UTC (rev 15008) @@ -507,7 +507,7 @@ if (current) RtlpCreateUnicodeString (RemainingPath, current, NonPagedPool); - RtlFreeUnicodeString (&PathString); + ExFreePool(PathString.Buffer); *ReturnedObject = CurrentObject; return STATUS_SUCCESS; @@ -806,7 +806,7 @@ } RtlFreeUnicodeString(&Header->Name); RtlFreeUnicodeString(&RemainingPath); - ExFreePool(Header); + ExFreePoolWithTag(Header, Header->ObjectType->Tag); DPRINT("Create Failed\n"); return Status; } @@ -1000,7 +1000,7 @@ } DPRINT("ObPerformRetentionChecks() = Freeing object\n"); - ExFreePool(Header); + ExFreePoolWithTag(Header, Header->ObjectType->Tag); return(STATUS_SUCCESS); } @@ -1010,16 +1010,14 @@ ObpDeleteObjectWorkRoutine (IN PVOID Parameter) { PRETENTION_CHECK_PARAMS Params = (PRETENTION_CHECK_PARAMS)Parameter; - /* ULONG Tag; */ /* See below */ + ULONG Tag; ASSERT(Params); ASSERT(KeGetCurrentIrql() == PASSIVE_LEVEL); /* We need PAGED_CODE somewhere... */ - /* Turn this on when we have ExFreePoolWithTag - Tag = Params->ObjectHeader->ObjectType->Tag; */ + Tag = Params->ObjectHeader->ObjectType->Tag; ObpDeleteObject(Params->ObjectHeader); - ExFreePool(Params); - /* ExFreePoolWithTag(Params, Tag); */ + ExFreePoolWithTag(Params, Tag); }
19 years, 6 months
1
0
0
0
[ekohl] 15007: Implement OpenAndMapFileForRead, RetreiveFileSecurity, StampFileSecurity, TakeOwnershipOfFile and UnmapAndCloseFile.
by ekohl@svn.reactos.com
Implement OpenAndMapFileForRead, RetreiveFileSecurity, StampFileSecurity, TakeOwnershipOfFile and UnmapAndCloseFile. Modified: trunk/reactos/include/wine/setupapi.h Modified: trunk/reactos/lib/setupapi/misc.c Modified: trunk/reactos/lib/setupapi/setupapi.spec _____ Modified: trunk/reactos/include/wine/setupapi.h --- trunk/reactos/include/wine/setupapi.h 2005-05-05 16:15:08 UTC (rev 15006) +++ trunk/reactos/include/wine/setupapi.h 2005-05-05 16:16:28 UTC (rev 15007) @@ -681,7 +681,9 @@ VOID WINAPI MyFree(PVOID lpMem); PVOID WINAPI MyMalloc(DWORD dwSize); PVOID WINAPI MyRealloc(PVOID lpSrc, DWORD dwSize); +DWORD WINAPI OpenAndMapForRead(PCWSTR, PDWORD, PHANDLE, PHANDLE, PVOID *); LONG WINAPI QueryRegistryValue(HKEY, PCWSTR, PBYTE *, PDWORD, PDWORD); +DWORD WINAPI RetreiveFileSecurity(PCWSTR, PSECURITY_DESCRIPTOR *); BOOL WINAPI SetupCloseFileQueue( HSPFILEQ ); void WINAPI SetupCloseInfFile( HINF hinf ); BOOL WINAPI SetupCommitFileQueueA( HWND, HSPFILEQ, PSP_FILE_CALLBACK_A, PVOID ); @@ -820,8 +822,12 @@ #define SetupSetFileQueueAlternatePlatform WINELIB_NAME_AW(SetupSetFileQueueAlternatePlatform) BOOL WINAPI SetupSetFileQueueFlags( HSPFILEQ, DWORD, DWORD ); void WINAPI SetupTermDefaultQueueCallback( PVOID ); +DWORD WINAPI StampFileSecurity(PCWSTR, PSECURITY_DESCRIPTOR); +DWORD WINAPI TakeOwnershipOfFile(PCWSTR); PSTR WINAPI UnicodeToMultiByte(PCWSTR lpUnicodeStr, UINT uCodePage); +BOOL WINAPI UnmapAndCloseFile(HANDLE, HANDLE, PVOID); + #undef DECL_WINELIB_SETUPAPI_TYPE_AW #endif /* _INC_SETUPAPI */ _____ Modified: trunk/reactos/lib/setupapi/misc.c --- trunk/reactos/lib/setupapi/misc.c 2005-05-05 16:15:08 UTC (rev 15006) +++ trunk/reactos/lib/setupapi/misc.c 2005-05-05 16:16:28 UTC (rev 15007) @@ -549,12 +549,12 @@ */ DWORD WINAPI CaptureStringArg(LPCWSTR pSrc, LPWSTR *pDst) { - if (pDst == NULL) - return ERROR_INVALID_PARAMETER; + if (pDst == NULL) + return ERROR_INVALID_PARAMETER; - *pDst = DuplicateString(pSrc); + *pDst = DuplicateString(pSrc); - return ERROR_SUCCESS; + return ERROR_SUCCESS; } @@ -576,10 +576,265 @@ */ DWORD WINAPI CaptureAndConvertAnsiArg(LPCSTR pSrc, LPWSTR *pDst) { - if (pDst == NULL) - return ERROR_INVALID_PARAMETER; + if (pDst == NULL) + return ERROR_INVALID_PARAMETER; - *pDst = MultiByteToUnicode(pSrc, CP_ACP); + *pDst = MultiByteToUnicode(pSrc, CP_ACP); - return ERROR_SUCCESS; + return ERROR_SUCCESS; } + + +/********************************************************************** **** + * OpenAndMapFileForRead [SETUPAPI.@] + * + * Open and map a file to a buffer. + * + * PARAMS + * lpFileName [I] Name of the file to be opened + * lpSize [O] Pointer to the file size + * lpFile [0] Pointer to the file handle + * lpMapping [0] Pointer to the mapping handle + * lpBuffer [0] Pointer to the file buffer + * + * RETURNS + * Success: ERROR_SUCCESS + * Failure: Other + * + * NOTE + * Call UnmapAndCloseFile to release the file. + */ +DWORD WINAPI OpenAndMapFileForRead(LPCWSTR lpFileName, + LPDWORD lpSize, + LPHANDLE lpFile, + LPHANDLE lpMapping, + LPVOID *lpBuffer) +{ + DWORD dwError; + + TRACE("%s %p %p %p %p\n", + debugstr_w(lpFileName), lpSize, lpFile, lpMapping, lpBuffer); + + *lpFile = CreateFileW(lpFileName, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, 0, NULL); + if (*lpFile == INVALID_HANDLE_VALUE) + return GetLastError(); + + *lpSize = GetFileSize(*lpFile, NULL); + if (*lpSize == INVALID_FILE_SIZE) + { + dwError = GetLastError(); + CloseHandle(*lpFile); + return dwError; + } + + *lpMapping = CreateFileMappingW(*lpFile, NULL, PAGE_READONLY, 0, + *lpSize, NULL); + if (*lpMapping == NULL) + { + dwError = GetLastError(); + CloseHandle(*lpFile); + return dwError; + } + + *lpBuffer = MapViewOfFile(*lpMapping, FILE_MAP_READ, 0, 0, *lpSize); + if (*lpBuffer == NULL) + { + dwError = GetLastError(); + CloseHandle(*lpMapping); + CloseHandle(*lpFile); + return dwError; + } + + return ERROR_SUCCESS; +} + + +/********************************************************************** **** + * UnmapAndCloseFile [SETUPAPI.@] + * + * Unmap and close a mapped file. + * + * PARAMS + * hFile [I] Handle to the file + * hMapping [I] Handle to the file mapping + * lpBuffer [I] Pointer to the file buffer + * + * RETURNS + * Success: TRUE + * Failure: FALSE + */ +BOOL WINAPI UnmapAndCloseFile(HANDLE hFile, HANDLE hMapping, LPVOID lpBuffer) +{ + TRACE("%x %x %p\n", + hFile, hMapping, lpBuffer); + + if (!UnmapViewOfFile(lpBuffer)) + return FALSE; + + if (!CloseHandle(hMapping)) + return FALSE; + + if (!CloseHandle(hFile)) + return FALSE; + + return TRUE; +} + + +/********************************************************************** **** + * StampFileSecurity [SETUPAPI.@] + * + * Assign a new security descriptor to the given file. + * + * PARAMS + * lpFileName [I] Name of the file + * pSecurityDescriptor [I] New security descriptor + * + * RETURNS + * Success: ERROR_SUCCESS + * Failure: other + */ +DWORD WINAPI StampFileSecurity(LPCWSTR lpFileName, PSECURITY_DESCRIPTOR pSecurityDescriptor) +{ + TRACE("%s %p\n", debugstr_w(lpFileName), pSecurityDescriptor); + + if (!SetFileSecurityW(lpFileName, OWNER_SECURITY_INFORMATION | + GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, + pSecurityDescriptor)) + return GetLastError(); + + return ERROR_SUCCESS; +} + + +/********************************************************************** **** + * TakeOwnershipOfFile [SETUPAPI.@] + * + * Takes the ownership of the given file. + * + * PARAMS + * lpFileName [I] Name of the file + * + * RETURNS + * Success: ERROR_SUCCESS + * Failure: other + */ +DWORD WINAPI TakeOwnershipOfFile(LPCWSTR lpFileName) +{ + SECURITY_DESCRIPTOR SecDesc; + HANDLE hToken = NULL; + PTOKEN_OWNER pOwner = NULL; + DWORD dwError; + DWORD dwSize; + + TRACE("%s\n", debugstr_w(lpFileName)); + + if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken)) + return GetLastError(); + + if (!GetTokenInformation(hToken, TokenOwner, NULL, 0, &dwSize)) + { + goto fail; + } + + pOwner = (PTOKEN_OWNER)MyMalloc(dwSize); + if (pOwner == NULL) + { + CloseHandle(hToken); + return ERROR_NOT_ENOUGH_MEMORY; + } + + if (!GetTokenInformation(hToken, TokenOwner, pOwner, dwSize, &dwSize)) + { + goto fail; + } + + if (!InitializeSecurityDescriptor(&SecDesc, SECURITY_DESCRIPTOR_REVISION)) + { + goto fail; + } + + if (!SetSecurityDescriptorOwner(&SecDesc, pOwner->Owner, FALSE)) + { + goto fail; + } + + if (!SetFileSecurityW(lpFileName, OWNER_SECURITY_INFORMATION, &SecDesc)) + { + goto fail; + } + + MyFree(pOwner); + CloseHandle(hToken); + + return ERROR_SUCCESS; + +fail:; + dwError = GetLastError(); + + if (pOwner != NULL) + MyFree(pOwner); + + if (hToken != NULL) + CloseHandle(hToken); + + return dwError; +} + + +/********************************************************************** **** + * RetreiveFileSecurity [SETUPAPI.@] + * + * Retrieve the security descriptor that is associated with the given file. + * + * PARAMS + * lpFileName [I] Name of the file + * + * RETURNS + * Success: ERROR_SUCCESS + * Failure: other + */ +DWORD WINAPI RetreiveFileSecurity(LPCWSTR lpFileName, + PSECURITY_DESCRIPTOR *pSecurityDescriptor) +{ + PSECURITY_DESCRIPTOR SecDesc; + DWORD dwSize = 0x100; + DWORD dwError; + + SecDesc = (PSECURITY_DESCRIPTOR)MyMalloc(dwSize); + if (SecDesc == NULL) + return ERROR_NOT_ENOUGH_MEMORY; + + if (GetFileSecurityW(lpFileName, OWNER_SECURITY_INFORMATION | + GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, + SecDesc, dwSize, &dwSize)) + { + *pSecurityDescriptor = SecDesc; + return ERROR_SUCCESS; + } + + dwError = GetLastError(); + if (dwError != ERROR_INSUFFICIENT_BUFFER) + { + MyFree(SecDesc); + return dwError; + } + + SecDesc = (PSECURITY_DESCRIPTOR)MyRealloc(SecDesc, dwSize); + if (SecDesc == NULL) + return ERROR_NOT_ENOUGH_MEMORY; + + if (GetFileSecurityW(lpFileName, OWNER_SECURITY_INFORMATION | + GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, + SecDesc, dwSize, &dwSize)) + { + *pSecurityDescriptor = SecDesc; + return ERROR_SUCCESS; + } + + dwError = GetLastError(); + MyFree(SecDesc); + + return dwError; +} _____ Modified: trunk/reactos/lib/setupapi/setupapi.spec --- trunk/reactos/lib/setupapi/setupapi.spec 2005-05-05 16:15:08 UTC (rev 15006) +++ trunk/reactos/lib/setupapi/setupapi.spec 2005-05-05 16:16:28 UTC (rev 15007) @@ -223,13 +223,13 @@ @ stub MyGetFileTitle @ stdcall MyMalloc(long) @ stdcall MyRealloc(ptr long) -@ stub OpenAndMapFileForRead +@ stdcall OpenAndMapFileForRead(wstr ptr ptr ptr ptr) @ stub OutOfMemory @ stub QueryMultiSzValueToArray @ stdcall QueryRegistryValue(long wstr ptr ptr ptr) @ stub ReadAsciiOrUnicodeTextFile @ stub RegistryDelnode -@ stub RetreiveFileSecurity +@ stdcall RetreiveFileSecurity(wstr ptr) @ stub RetrieveServiceConfig @ stub SearchForInfFile @ stub SetArrayToMultiSzValue @@ -512,7 +512,7 @@ @ stdcall SetupTermDefaultQueueCallback(ptr) @ stdcall SetupTerminateFileLog(long) @ stub ShouldDeviceBeExcluded -@ stub StampFileSecurity +@ stdcall StampFileSecurity(wstr ptr) @ stub StringTableAddString @ stub StringTableAddStringEx @ stub StringTableDestroy @@ -526,9 +526,9 @@ @ stub StringTableSetExtraData @ stub StringTableStringFromId @ stub StringTableTrim -@ stub TakeOwnershipOfFile +@ stdcall TakeOwnershipOfFile(wstr) @ stdcall UnicodeToMultiByte(wstr long) -@ stub UnmapAndCloseFile +@ stdcall UnmapAndCloseFile(long long ptr) @ stub VerifyCatalogFile @ stub VerifyFile @ stub pSetupAccessRunOnceNodeList
19 years, 6 months
1
0
0
0
[weiden] 15006: the registry functions shouldn't change the last error, instead they should just return the error code.
by weiden@svn.reactos.com
the registry functions shouldn't change the last error, instead they should just return the error code. Modified: trunk/reactos/lib/advapi32/reg/reg.c _____ Modified: trunk/reactos/lib/advapi32/reg/reg.c --- trunk/reactos/lib/advapi32/reg/reg.c 2005-05-05 16:05:46 UTC (rev 15005) +++ trunk/reactos/lib/advapi32/reg/reg.c 2005-05-05 16:15:08 UTC (rev 15006) @@ -264,7 +264,6 @@ LONG STDCALL RegCloseKey (HKEY hKey) { - LONG ErrorCode; NTSTATUS Status; /* don't close null handle or a pseudo handle */ @@ -276,9 +275,7 @@ Status = NtClose (hKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } return ERROR_SUCCESS; @@ -444,7 +441,6 @@ UNICODE_STRING ClassString; OBJECT_ATTRIBUTES Attributes; HANDLE ParentKey; - LONG ErrorCode; NTSTATUS Status; DPRINT("RegCreateKeyExA() called\n"); @@ -454,9 +450,7 @@ hKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } DPRINT("ParentKey %x\n", (ULONG)ParentKey); @@ -488,9 +482,7 @@ DPRINT("Status %x\n", Status); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } return ERROR_SUCCESS; @@ -517,7 +509,6 @@ UNICODE_STRING ClassString; OBJECT_ATTRIBUTES Attributes; HANDLE ParentKey; - LONG ErrorCode; NTSTATUS Status; DPRINT("RegCreateKeyExW() called\n"); @@ -527,9 +518,7 @@ hKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError(Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError(Status); } DPRINT("ParentKey %x\n", (ULONG)ParentKey); @@ -551,9 +540,7 @@ DPRINT("Status %x\n", Status); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } return ERROR_SUCCESS; @@ -618,15 +605,12 @@ HANDLE ParentKey; HANDLE TargetKey; NTSTATUS Status; - LONG ErrorCode; Status = MapDefaultKey (&ParentKey, hKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } RtlCreateUnicodeStringFromAsciiz (&SubKeyName, @@ -643,18 +627,14 @@ RtlFreeUnicodeString (&SubKeyName); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } Status = NtDeleteKey (TargetKey); NtClose (TargetKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError(Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError(Status); } return ERROR_SUCCESS; @@ -675,15 +655,12 @@ HANDLE ParentKey; HANDLE TargetKey; NTSTATUS Status; - LONG ErrorCode; Status = MapDefaultKey (&ParentKey, hKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } RtlInitUnicodeString (&SubKeyName, @@ -698,18 +675,14 @@ &ObjectAttributes); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } Status = NtDeleteKey (TargetKey); NtClose (TargetKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } return ERROR_SUCCESS; @@ -727,16 +700,13 @@ { UNICODE_STRING ValueName; HANDLE KeyHandle; - LONG ErrorCode; NTSTATUS Status; Status = MapDefaultKey (&KeyHandle, hKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } RtlCreateUnicodeStringFromAsciiz (&ValueName, @@ -746,9 +716,7 @@ RtlFreeUnicodeString (&ValueName); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } return ERROR_SUCCESS; @@ -766,16 +734,13 @@ { UNICODE_STRING ValueName; NTSTATUS Status; - LONG ErrorCode; HANDLE KeyHandle; Status = MapDefaultKey (&KeyHandle, hKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } RtlInitUnicodeString (&ValueName, @@ -785,9 +750,7 @@ &ValueName); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } return ERROR_SUCCESS; @@ -880,16 +843,13 @@ if ((lpClass) && (!lpcbClass)) { - SetLastError (ERROR_INVALID_PARAMETER); return ERROR_INVALID_PARAMETER; } Status = MapDefaultKey(&KeyHandle, hKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } if (*lpcbName > 0) @@ -923,7 +883,6 @@ KeyInfo = RtlAllocateHeap (ProcessHeap, 0, BufferSize); if (KeyInfo == NULL) { - SetLastError (ERROR_OUTOFMEMORY); return ERROR_OUTOFMEMORY; } @@ -1010,11 +969,6 @@ 0, KeyInfo); - if (ErrorCode != ERROR_SUCCESS) - { - SetLastError(ErrorCode); - } - return ErrorCode; } @@ -1052,9 +1006,7 @@ hKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } if (*lpcbName > 0) @@ -1089,7 +1041,6 @@ BufferSize); if (KeyInfo == NULL) { - SetLastError (ERROR_OUTOFMEMORY); return ERROR_OUTOFMEMORY; } @@ -1162,11 +1113,6 @@ 0, KeyInfo); - if (ErrorCode != ERROR_SUCCESS) - { - SetLastError(ErrorCode); - } - return ErrorCode; } @@ -1194,10 +1140,7 @@ status = MapDefaultKey (&KeyHandle, hKey); if (!NT_SUCCESS(status)) { - LONG ErrorCode; - ErrorCode = RtlNtStatusToDosError (status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (status); } total_size = info_size + (MAX_PATH + 1) * sizeof(WCHAR); @@ -1321,10 +1264,7 @@ status = MapDefaultKey (&KeyHandle, hKey); if (!NT_SUCCESS(status)) { - LONG ErrorCode; - ErrorCode = RtlNtStatusToDosError (status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (status); } total_size = info_size + (MAX_PATH + 1) * sizeof(WCHAR); @@ -1399,7 +1339,6 @@ RegFlushKey(HKEY hKey) { HANDLE KeyHandle; - LONG ErrorCode; NTSTATUS Status; if (hKey == HKEY_PERFORMANCE_DATA) @@ -1411,17 +1350,13 @@ hKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } Status = NtFlushKey (KeyHandle); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } return ERROR_SUCCESS; @@ -1440,12 +1375,10 @@ LPDWORD lpcbSecurityDescriptor) { HANDLE KeyHandle; - LONG ErrorCode; NTSTATUS Status; if (hKey == HKEY_PERFORMANCE_DATA) { - SetLastError(ERROR_INVALID_HANDLE); return ERROR_INVALID_HANDLE; } @@ -1454,9 +1387,7 @@ if (!NT_SUCCESS(Status)) { DPRINT("MapDefaultKey() failed (Status %lx)\n", Status); - ErrorCode = RtlNtStatusToDosError(Status); - SetLastError(ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } Status = NtQuerySecurityObject(KeyHandle, @@ -1467,9 +1398,7 @@ if (!NT_SUCCESS(Status)) { DPRINT("NtQuerySecurityObject() failed (Status %lx)\n", Status); - ErrorCode = RtlNtStatusToDosError(Status); - SetLastError(ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } return ERROR_SUCCESS; @@ -1521,12 +1450,10 @@ UNICODE_STRING FileName; UNICODE_STRING KeyName; HANDLE KeyHandle; - LONG ErrorCode; NTSTATUS Status; if (hKey == HKEY_PERFORMANCE_DATA) { - SetLastError(ERROR_INVALID_HANDLE); return ERROR_INVALID_HANDLE; } @@ -1534,9 +1461,7 @@ hKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } if (!RtlDosPathNameToNtPathName_U ((LPWSTR)lpFile, @@ -1544,7 +1469,6 @@ NULL, NULL)) { - SetLastError (ERROR_BAD_PATHNAME); return ERROR_BAD_PATHNAME; } @@ -1570,9 +1494,7 @@ if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } return ERROR_SUCCESS; @@ -1720,7 +1642,6 @@ OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING SubKeyString; HANDLE KeyHandle; - LONG ErrorCode; NTSTATUS Status; DPRINT("RegOpenKeyExA hKey 0x%x lpSubKey %s ulOptions 0x%x samDesired 0x%x phkResult %p\n", @@ -1729,9 +1650,7 @@ Status = MapDefaultKey (&KeyHandle, hKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } RtlCreateUnicodeStringFromAsciiz (&SubKeyString, (LPSTR)lpSubKey); @@ -1745,9 +1664,7 @@ RtlFreeUnicodeString (&SubKeyString); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } return ERROR_SUCCESS; @@ -1769,7 +1686,6 @@ OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING SubKeyString; HANDLE KeyHandle; - LONG ErrorCode; NTSTATUS Status; DPRINT("RegOpenKeyExW hKey 0x%x lpSubKey %S ulOptions 0x%x samDesired 0x%x phkResult %p\n", @@ -1778,9 +1694,7 @@ Status = MapDefaultKey (&KeyHandle, hKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } if (lpSubKey != NULL) @@ -1798,9 +1712,7 @@ if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } return ERROR_SUCCESS; @@ -1893,12 +1805,11 @@ ULONG ClassLength = 0; HANDLE KeyHandle; NTSTATUS Status; - LONG ErrorCode = ERROR_SUCCESS; ULONG Length; + LONG ErrorCode = ERROR_SUCCESS; if ((lpClass) && (!lpcbClass)) { - SetLastError(ERROR_INVALID_PARAMETER); return ERROR_INVALID_PARAMETER; } @@ -1906,9 +1817,7 @@ hKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } if (lpClass != NULL) @@ -1928,7 +1837,6 @@ FullInfoSize); if (FullInfo == NULL) { - SetLastError (ERROR_OUTOFMEMORY); return ERROR_OUTOFMEMORY; } @@ -1957,9 +1865,7 @@ FullInfo); } - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } DPRINT("SubKeys %d\n", FullInfo->SubKeys); @@ -2016,9 +1922,7 @@ FullInfo); } - ErrorCode = RtlNtStatusToDosError(Status); - SetLastError(ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } } @@ -2048,11 +1952,6 @@ FullInfo); } - if (ErrorCode != ERROR_SUCCESS) - { - SetLastError (ErrorCode); - } - return ErrorCode; } @@ -2201,10 +2100,10 @@ PKEY_VALUE_PARTIAL_INFORMATION ValueInfo; UNICODE_STRING ValueName; NTSTATUS Status; - LONG ErrorCode = ERROR_SUCCESS; ULONG BufferSize; ULONG ResultSize; HANDLE KeyHandle; + LONG ErrorCode = ERROR_SUCCESS; ULONG MaxCopy = lpcbData != NULL && lpData != NULL ? *lpcbData : 0; DPRINT("hKey 0x%X lpValueName %S lpData 0x%X lpcbData %d\n", @@ -2214,14 +2113,11 @@ hKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } if (lpData != NULL && lpcbData == NULL) { - SetLastError (ERROR_INVALID_PARAMETER); return ERROR_INVALID_PARAMETER; } @@ -2233,7 +2129,6 @@ BufferSize); if (ValueInfo == NULL) { - SetLastError(ERROR_OUTOFMEMORY); return ERROR_OUTOFMEMORY; } @@ -2253,7 +2148,6 @@ else if (!NT_SUCCESS(Status)) { ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); MaxCopy = 0; if (lpcbData != NULL) { @@ -2332,7 +2226,6 @@ if (lpData != NULL && lpcbData == NULL) { - SetLastError(ERROR_INVALID_PARAMETER); return ERROR_INVALID_PARAMETER; } @@ -2345,7 +2238,6 @@ ValueData.MaximumLength); if (!ValueData.Buffer) { - SetLastError(ERROR_OUTOFMEMORY); return ERROR_OUTOFMEMORY; } } @@ -2441,7 +2333,6 @@ if (lpValue != NULL && lpcbValue == NULL) { - SetLastError(ERROR_INVALID_PARAMETER); return ERROR_INVALID_PARAMETER; } @@ -2470,7 +2361,6 @@ ValueSize); if (Value.Buffer == NULL) { - SetLastError(ERROR_OUTOFMEMORY); return ERROR_OUTOFMEMORY; } } @@ -2533,9 +2423,7 @@ hKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } if (lpSubKey != NULL && @@ -2553,9 +2441,7 @@ &ObjectAttributes); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } CloseRealKey = TRUE; } @@ -2636,7 +2522,6 @@ BOOLEAN CloseRealKey; HANDLE RealKeyHandle; HANDLE KeyHandle; - LONG ErrorCode; NTSTATUS Status; if (hKey == HKEY_PERFORMANCE_DATA) @@ -2648,9 +2533,7 @@ hKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } /* Open the real key */ @@ -2668,9 +2551,7 @@ &KeyObjectAttributes); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } CloseRealKey = TRUE; } @@ -2690,7 +2571,6 @@ { NtClose (RealKeyHandle); } - SetLastError (ERROR_INVALID_PARAMETER); return ERROR_INVALID_PARAMETER; } @@ -2711,7 +2591,6 @@ { NtClose (RealKeyHandle); } - SetLastError (ERROR_INVALID_PARAMETER); return ERROR_INVALID_PARAMETER; } @@ -2735,9 +2614,7 @@ if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } return ERROR_SUCCESS; @@ -2785,7 +2662,6 @@ UNICODE_STRING FileName; HANDLE FileHandle; HANDLE KeyHandle; - LONG ErrorCode; NTSTATUS Status; if (hKey == HKEY_PERFORMANCE_DATA) @@ -2797,9 +2673,7 @@ hKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } if (!RtlDosPathNameToNtPathName_U ((LPWSTR)lpFile, @@ -2807,7 +2681,6 @@ NULL, NULL)) { - SetLastError (ERROR_INVALID_PARAMETER); return ERROR_INVALID_PARAMETER; } @@ -2826,9 +2699,7 @@ RtlFreeUnicodeString (&FileName); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } Status = NtRestoreKey (KeyHandle, @@ -2837,9 +2708,7 @@ NtClose (FileHandle); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } return ERROR_SUCCESS; @@ -2887,15 +2756,12 @@ HANDLE FileHandle; HANDLE KeyHandle; NTSTATUS Status; - LONG ErrorCode; Status = MapDefaultKey (&KeyHandle, hKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } if (!RtlDosPathNameToNtPathName_U ((PWSTR)lpFile, @@ -2903,7 +2769,6 @@ NULL, NULL)) { - SetLastError (ERROR_INVALID_PARAMETER); return ERROR_INVALID_PARAMETER; } @@ -2931,9 +2796,7 @@ RtlFreeUnicodeString (&FileName); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } Status = NtSaveKey (KeyHandle, @@ -2941,9 +2804,7 @@ NtClose (FileHandle); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } return ERROR_SUCCESS; @@ -2961,12 +2822,10 @@ PSECURITY_DESCRIPTOR pSecurityDescriptor) { HANDLE KeyHandle; - LONG ErrorCode; NTSTATUS Status; if (hKey == HKEY_PERFORMANCE_DATA) { - SetLastError(ERROR_INVALID_HANDLE); return ERROR_INVALID_HANDLE; } @@ -2974,9 +2833,7 @@ hKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } Status = NtSetSecurityObject (KeyHandle, @@ -2984,9 +2841,7 @@ pSecurityDescriptor); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } return ERROR_SUCCESS; @@ -3097,15 +2952,12 @@ PUNICODE_STRING pValueName; HANDLE KeyHandle; NTSTATUS Status; - LONG ErrorCode; Status = MapDefaultKey (&KeyHandle, hKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } if (lpValueName != NULL) @@ -3136,9 +2988,7 @@ (ULONG)cbData); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } return ERROR_SUCCESS; @@ -3211,17 +3061,15 @@ UNICODE_STRING SubKeyString; HANDLE KeyHandle; HANDLE RealKey; - LONG ErrorCode; BOOL CloseRealKey; NTSTATUS Status; + LONG ErrorCode; Status = MapDefaultKey (&KeyHandle, hKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } if ((lpSubKey) && (wcslen(lpSubKey) != 0)) @@ -3238,9 +3086,7 @@ &ObjectAttributes); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } CloseRealKey = TRUE; } @@ -3301,21 +3147,17 @@ OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING KeyName; HANDLE KeyHandle; - DWORD ErrorCode; NTSTATUS Status; if (hKey == HKEY_PERFORMANCE_DATA) { - SetLastError(ERROR_INVALID_HANDLE); return ERROR_INVALID_HANDLE; } Status = MapDefaultKey (&KeyHandle, hKey); if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } RtlInitUnicodeString (&KeyName, @@ -3331,9 +3173,7 @@ if (!NT_SUCCESS(Status)) { - ErrorCode = RtlNtStatusToDosError (Status); - SetLastError (ErrorCode); - return ErrorCode; + return RtlNtStatusToDosError (Status); } return ERROR_SUCCESS;
19 years, 6 months
1
0
0
0
[greatlrd] 15005: Update the swedish translation by
by greatlrd@svn.reactos.com
Update the swedish translation by David Nordenberg Modified: trunk/reactos/subsys/system/taskmgr/Sv.rc _____ Modified: trunk/reactos/subsys/system/taskmgr/Sv.rc --- trunk/reactos/subsys/system/taskmgr/Sv.rc 2005-05-05 15:39:36 UTC (rev 15004) +++ trunk/reactos/subsys/system/taskmgr/Sv.rc 2005-05-05 16:05:46 UTC (rev 15005) @@ -35,7 +35,7 @@ BEGIN MENUITEM "&Ny Aktivitet (K÷r...)", ID_FILE_NEW MENUITEM SEPARATOR - MENUITEM "&Avsluta aktivitetshanteraren", ID_FILE_EXIT + MENUITEM "&Avsluta Aktivitetshanteraren", ID_FILE_EXIT END POPUP "&Alternativ" BEGIN @@ -264,12 +264,12 @@ ES_READONLY | ES_NUMBER | NOT WS_BORDER EDITTEXT IDC_PHYSICAL_MEMORY_SYSTEM_CACHE,185,149,48,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER - LTEXT "Totalt",IDS_KERNEL_MEMORY_TOTAL,137,174,27,8 - LTEXT "Võxlat",IDS_KERNEL_MEMORY_PAGED,137,184,24,8 - LTEXT "Icke võxlat",IDS_KERNEL_MEMORY_NONPAGED,137,193,44,8 + LTEXT "Totalt",IDS_KERNEL_MEMORY_TOTAL,137,175,27,8 + LTEXT "Fysiskt / virtuellt",IDS_KERNEL_MEMORY_PAGED,137,184,56,8 + LTEXT "Fysiskt",IDS_KERNEL_MEMORY_NONPAGED,137,193,44,8 EDITTEXT IDC_KERNEL_MEMORY_TOTAL,185,174,48,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER - EDITTEXT IDC_KERNEL_MEMORY_PAGED,185,184,48,8,ES_RIGHT | + EDITTEXT IDC_KERNEL_MEMORY_PAGED,190,184,43,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER EDITTEXT IDC_KERNEL_MEMORY_NONPAGED,185,193,48,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER @@ -555,7 +555,7 @@ BEGIN IDS_APP_TITLE "Aktivitetshanteraren" IDC_TASKMGR "Aktivitetshanteraren" - IDS_IDLE_PROCESS "System Idle Process" + IDS_IDLE_PROCESS "Systemets lediga resurser" END STRINGTABLE DISCARDABLE @@ -579,7 +579,7 @@ ID_VIEW_UPDATESPEED_PAUSED "Uppdaterar inte automatiskt" ID_WINDOWS_TILEHORIZONTALLY "Ordna f÷nstren horizontellt pÕ skrivbordet" - ID_WINDOWS_TILEVERTICALLY "Ordna f÷nstren vertikalt pÕ skrivborder" + ID_WINDOWS_TILEVERTICALLY "Ordna f÷nstren vertikalt pÕ skrivbordet" ID_WINDOWS_MINIMIZE "Minimerar f÷nstret" ID_WINDOWS_MAXIMIZE "Maximerar f÷nstret" ID_WINDOWS_CASCADE "Ordna f÷nstren diagonalt ÷verlappande pÕ skrivbordet" @@ -677,8 +677,10 @@ IDS_MSG_UNABLETERMINATEPRO "Kunde inte avsluta processen" IDS_MSG_UNABLECHANGEPRIORITY "Kunde inte õndra prioritet" IDS_MSG_WARNINGCHANGEPRIORITY "VARNING: ?ndring av prioritetsklassen hos den hõr processen kan\norsaka o÷nskade effekter och pÕverka systemets stabilitet. ?r du\nsõker pÕ att du vill õndra prioritetsklassen?" - IDS_MSG_TRAYICONCPUUSAGE "CPU-anv: %d%%" - + IDS_MSG_TRAYICONCPUUSAGE "Processoranvõndning: %d%%" + IDS_STATUS_MEMUSAGE "Minnesanv: %dK / %dK" + IDS_STATUS_CPUUSAGE "Processoranv: %3d%%" + IDS_STATUS_PROCESSES "Processer: %d" END
19 years, 6 months
1
0
0
0
[hpoussin] 15004: Don't desallocate non allocated memory
by hpoussin@svn.reactos.com
Don't desallocate non allocated memory Modified: trunk/reactos/drivers/dd/serial/circularbuffer.c _____ Modified: trunk/reactos/drivers/dd/serial/circularbuffer.c --- trunk/reactos/drivers/dd/serial/circularbuffer.c 2005-05-05 15:39:27 UTC (rev 15003) +++ trunk/reactos/drivers/dd/serial/circularbuffer.c 2005-05-05 15:39:36 UTC (rev 15004) @@ -32,7 +32,8 @@ { DPRINT("Serial: FreeCircularBuffer(pBuffer %p)\n", pBuffer); ASSERT(pBuffer); - ExFreePoolWithTag(pBuffer->Buffer, SERIAL_TAG); + if (pBuffer->Buffer != NULL) + ExFreePoolWithTag(pBuffer->Buffer, SERIAL_TAG); return STATUS_SUCCESS; }
19 years, 6 months
1
0
0
0
[weiden] 15003: - ported BuildTrusteeWithObjectsAndNameA/W and BuildTrusteeWithObjectsAndSidA/W from wine
by weiden@svn.reactos.com
- ported BuildTrusteeWithObjectsAndNameA/W and BuildTrusteeWithObjectsAndSidA/W from wine - implemented RegOpenCurrentUser - directly forward GetSecurityDescriptorLength to NTDLL.RtlLengthSecurityDescriptorguard dumping the stack trace to prevent infinite exception loopsguard dumping the stack trace to prevent infinite exception loops Modified: trunk/reactos/lib/advapi32/advapi32.def Modified: trunk/reactos/lib/advapi32/reg/reg.c Modified: trunk/reactos/lib/advapi32/sec/sec.c Modified: trunk/reactos/lib/advapi32/sec/trustee.c _____ Modified: trunk/reactos/lib/advapi32/advapi32.def --- trunk/reactos/lib/advapi32/advapi32.def 2005-05-05 15:39:09 UTC (rev 15002) +++ trunk/reactos/lib/advapi32/advapi32.def 2005-05-05 15:39:27 UTC (rev 15003) @@ -51,10 +51,10 @@ ;BuildSecurityDescriptorW@36 BuildTrusteeWithNameA@8 BuildTrusteeWithNameW@8 -;BuildTrusteeWithObjectsAndNameA@24 -;BuildTrusteeWithObjectsAndNameW@24 -;BuildTrusteeWithObjectsAndSidA@20 -;BuildTrusteeWithObjectsAndSidW@20 +BuildTrusteeWithObjectsAndNameA@24 +BuildTrusteeWithObjectsAndNameW@24 +BuildTrusteeWithObjectsAndSidA@20 +BuildTrusteeWithObjectsAndSidW@20 BuildTrusteeWithSidA@8 BuildTrusteeWithSidW@8 ;CancelOverlappedAccess@4 @@ -271,7 +271,7 @@ GetSecurityDescriptorControl@12 GetSecurityDescriptorDacl@16 GetSecurityDescriptorGroup@12 -GetSecurityDescriptorLength@4 +GetSecurityDescriptorLength(a)4=NTDLL.RtlLengthSecurityDescriptor GetSecurityDescriptorOwner@12 GetSecurityDescriptorRMControl@8 GetSecurityDescriptorSacl@16 @@ -487,7 +487,7 @@ RegLoadKeyA@12 RegLoadKeyW@12 RegNotifyChangeKeyValue@20 -;RegOpenCurrentUser +RegOpenCurrentUser@8 RegOpenKeyA@12 RegOpenKeyExA@20 RegOpenKeyExW@20 _____ Modified: trunk/reactos/lib/advapi32/reg/reg.c --- trunk/reactos/lib/advapi32/reg/reg.c 2005-05-05 15:39:09 UTC (rev 15002) +++ trunk/reactos/lib/advapi32/reg/reg.c 2005-05-05 15:39:27 UTC (rev 15003) @@ -1634,6 +1634,29 @@ /*********************************************************************** * + * RegOpenCurrentUser + * + * @implemented + */ +LONG STDCALL +RegOpenCurrentUser (IN REGSAM samDesired, + OUT PHKEY phkResult) +{ + NTSTATUS Status; + + Status = RtlOpenCurrentUser((ACCESS_MASK)samDesired, + (PHANDLE)phkResult); + if (!NT_SUCCESS(Status)) + { + /* NOTE - don't set the last error code! just return the error! */ + return RtlNtStatusToDosError(Status); + } + + return ERROR_SUCCESS; +} + + +/********************************************************************** ** * RegOpenKeyA * * 20050503 Fireball - imported from WINE _____ Modified: trunk/reactos/lib/advapi32/sec/sec.c --- trunk/reactos/lib/advapi32/sec/sec.c 2005-05-05 15:39:09 UTC (rev 15002) +++ trunk/reactos/lib/advapi32/sec/sec.c 2005-05-05 15:39:27 UTC (rev 15003) @@ -105,19 +105,6 @@ /* * @implemented */ -DWORD -STDCALL -GetSecurityDescriptorLength ( - PSECURITY_DESCRIPTOR pSecurityDescriptor - ) -{ - return RtlLengthSecurityDescriptor(pSecurityDescriptor); -} - - -/* - * @implemented - */ BOOL STDCALL GetSecurityDescriptorOwner ( _____ Modified: trunk/reactos/lib/advapi32/sec/trustee.c --- trunk/reactos/lib/advapi32/sec/trustee.c 2005-05-05 15:39:09 UTC (rev 15002) +++ trunk/reactos/lib/advapi32/sec/trustee.c 2005-05-05 15:39:27 UTC (rev 15003) @@ -191,6 +191,78 @@ /*********************************************************************** ******* + * BuildTrusteeWithObjectsAndNameA [ADVAPI32.@] + */ +VOID WINAPI +BuildTrusteeWithObjectsAndNameA(PTRUSTEEA pTrustee, POBJECTS_AND_NAME_A pObjName, + SE_OBJECT_TYPE ObjectType, LPSTR ObjectTypeName, + LPSTR InheritedObjectTypeName, LPSTR Name) +{ + DPRINT("%p %p 0x%08x %p %p %s\n", pTrustee, pObjName, + ObjectType, ObjectTypeName, InheritedObjectTypeName, debugstr_a(Name)); + + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_NAME; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = Name; +} + + +/********************************************************************** ******** + * BuildTrusteeWithObjectsAndNameW [ADVAPI32.@] + */ +VOID WINAPI +BuildTrusteeWithObjectsAndNameW(PTRUSTEEW pTrustee, POBJECTS_AND_NAME_W pObjName, + SE_OBJECT_TYPE ObjectType, LPWSTR ObjectTypeName, + LPWSTR InheritedObjectTypeName, LPWSTR Name) +{ + DPRINT("%p %p 0x%08x %p %p %s\n", pTrustee, pObjName, + ObjectType, ObjectTypeName, InheritedObjectTypeName, debugstr_w(Name)); + + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_NAME; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = Name; +} + + +/********************************************************************** ******** + * BuildTrusteeWithObjectsAndSidA [ADVAPI32.@] + */ +VOID WINAPI +BuildTrusteeWithObjectsAndSidA(PTRUSTEEA pTrustee, POBJECTS_AND_SID pObjSid, + GUID* pObjectGuid, GUID* pInheritedObjectGuid, PSID pSid) +{ + DPRINT("%p %p %p %p %p\n", pTrustee, pObjSid, pObjectGuid, pInheritedObjectGuid, pSid); + + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_SID; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = (LPSTR) pSid; +} + + +/********************************************************************** ******** + * BuildTrusteeWithObjectsAndSidW [ADVAPI32.@] + */ +VOID WINAPI +BuildTrusteeWithObjectsAndSidW(PTRUSTEEW pTrustee, POBJECTS_AND_SID pObjSid, + GUID* pObjectGuid, GUID* pInheritedObjectGuid, PSID pSid) +{ + DPRINT("%p %p %p %p %p\n", pTrustee, pObjSid, pObjectGuid, pInheritedObjectGuid, pSid); + + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_SID; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = (LPWSTR) pSid; +} + + +/********************************************************************** ******** * GetMultipleTrusteeA [ADVAPI32.@] */ PTRUSTEEA WINAPI
19 years, 6 months
1
0
0
0
[hpoussin] 15002: Better handle of wrong arguments in IoRegisterDeviceInterface
by hpoussin@svn.reactos.com
Better handle of wrong arguments in IoRegisterDeviceInterface Modified: trunk/reactos/ntoskrnl/io/deviface.c _____ Modified: trunk/reactos/ntoskrnl/io/deviface.c --- trunk/reactos/ntoskrnl/io/deviface.c 2005-05-05 15:38:32 UTC (rev 15001) +++ trunk/reactos/ntoskrnl/io/deviface.c 2005-05-05 15:39:09 UTC (rev 15002) @@ -585,6 +585,12 @@ ULONG i; NTSTATUS Status; + if (!(PhysicalDeviceObject->Flags & DO_BUS_ENUMERATED_DEVICE)) + { + DPRINT("PhysicalDeviceObject 0x%p is not a valid Pdo\n", PhysicalDeviceObject); + return STATUS_INVALID_PARAMETER_1; + } + Status = RtlStringFromGUID(InterfaceClassGuid, &GuidString); if (!NT_SUCCESS(Status)) { @@ -606,6 +612,7 @@ ASSERT(PdoNameInfo->Name.Length); /* Create base key name for this interface: HKLM\SYSTEM\CurrentControlSet\DeviceClasses\{GUID}\##?#ACPI#PNP0501#1#{G UID} */ + ASSERT(PhysicalDeviceObject->DeviceObjectExtension->DeviceNode); InstancePath = &PhysicalDeviceObject->DeviceObjectExtension->DeviceNode->InstancePath; BaseKeyName.Length = wcslen(BaseKeyString) * sizeof(WCHAR); BaseKeyName.MaximumLength = BaseKeyName.Length
19 years, 6 months
1
0
0
0
[weiden] 15001: guard dumping the stack trace to prevent infinite exception loops
by weiden@svn.reactos.com
guard dumping the stack trace to prevent infinite exception loops Modified: trunk/reactos/lib/kernel32/except/except.c _____ Modified: trunk/reactos/lib/kernel32/except/except.c --- trunk/reactos/lib/kernel32/except/except.c 2005-05-05 13:27:00 UTC (rev 15000) +++ trunk/reactos/lib/kernel32/except/except.c 2005-05-05 15:38:32 UTC (rev 15001) @@ -171,23 +171,31 @@ _dump_context ( ExceptionInfo->ContextRecord ); #ifdef _X86_ DbgPrint("Frames:\n"); - Frame = (PULONG)ExceptionInfo->ContextRecord->Ebp; - while (Frame[1] != 0 && Frame[1] != 0xdeadbeef) + _SEH_TRY { - if (IsBadReadPtr((PVOID)Frame[1], 4)) { - DbgPrint(" %8x%9s %s\n", Frame[1], "<invalid address>"," "); - } else { - _module_name_from_addr((const void*)Frame[1], &StartAddr, - szMod, sizeof(szMod)); - DbgPrint(" %8x+%-8x %s\n", - (PVOID)StartAddr, - (ULONG_PTR)Frame[1] - (ULONG_PTR)StartAddr, szMod); + Frame = (PULONG)ExceptionInfo->ContextRecord->Ebp; + while (Frame[1] != 0 && Frame[1] != 0xdeadbeef) + { + if (IsBadReadPtr((PVOID)Frame[1], 4)) { + DbgPrint(" %8x%9s %s\n", Frame[1], "<invalid address>"," "); + } else { + _module_name_from_addr((const void*)Frame[1], &StartAddr, + szMod, sizeof(szMod)); + DbgPrint(" %8x+%-8x %s\n", + (PVOID)StartAddr, + (ULONG_PTR)Frame[1] - (ULONG_PTR)StartAddr, szMod); + } + if (IsBadReadPtr((PVOID)Frame[0], sizeof(*Frame) * 2)) { + break; + } + Frame = (PULONG)Frame[0]; } - if (IsBadReadPtr((PVOID)Frame[0], sizeof(*Frame) * 2)) { - break; - } - Frame = (PULONG)Frame[0]; } + _SEH_HANDLE + { + DbgPrint("<error dumping stack trace: 0x%x>\n", _SEH_GetExceptionCode()); + } + _SEH_END; #endif }
19 years, 6 months
1
0
0
0
[hpoussin] 15000: Call Fs notifications at PASSIVE_LEVEL by using a guarded mutex
by hpoussin@svn.reactos.com
Call Fs notifications at PASSIVE_LEVEL by using a guarded mutex Use ExFreePoolWithTag instead of ExFreePool Modified: trunk/reactos/ntoskrnl/io/fs.c _____ Modified: trunk/reactos/ntoskrnl/io/fs.c --- trunk/reactos/ntoskrnl/io/fs.c 2005-05-05 13:24:39 UTC (rev 14999) +++ trunk/reactos/ntoskrnl/io/fs.c 2005-05-05 13:27:00 UTC (rev 15000) @@ -35,7 +35,7 @@ static ERESOURCE FileSystemListLock; static LIST_ENTRY FileSystemListHead; -static FAST_MUTEX FsChangeNotifyListLock; +static KGUARDED_MUTEX FsChangeNotifyListLock; static LIST_ENTRY FsChangeNotifyListHead; #define TAG_FILE_SYSTEM TAG('F', 'S', 'Y', 'S') @@ -178,7 +178,7 @@ ExInitializeResourceLite(&FileSystemListLock); InitializeListHead(&FsChangeNotifyListHead); - ExInitializeFastMutex(&FsChangeNotifyListLock); + KeInitializeGuardedMutex(&FsChangeNotifyListLock); } @@ -631,7 +631,7 @@ if (current->DeviceObject == DeviceObject) { RemoveEntryList(current_entry); - ExFreePool(current); + ExFreePoolWithTag(current, TAG_FILE_SYSTEM); ExReleaseResourceLite(&FileSystemListLock); KeLeaveCriticalRegion(); IopNotifyFileSystemChange(DeviceObject, FALSE); @@ -710,7 +710,7 @@ PFS_CHANGE_NOTIFY_ENTRY ChangeEntry; PLIST_ENTRY Entry; - ExAcquireFastMutex(&FsChangeNotifyListLock); + KeAcquireGuardedMutex(&FsChangeNotifyListLock); Entry = FsChangeNotifyListHead.Flink; while (Entry != &FsChangeNotifyListHead) { @@ -720,7 +720,7 @@ Entry = Entry->Flink; } - ExReleaseFastMutex(&FsChangeNotifyListLock); + KeReleaseGuardedMutex(&FsChangeNotifyListLock); } @@ -742,10 +742,10 @@ Entry->DriverObject = DriverObject; Entry->FSDNotificationProc = FSDNotificationProc; - ExAcquireFastMutex(&FsChangeNotifyListLock); + KeAcquireGuardedMutex(&FsChangeNotifyListLock); InsertHeadList(&FsChangeNotifyListHead, &Entry->FsChangeNotifyList); - ExReleaseFastMutex(&FsChangeNotifyListLock); + KeReleaseGuardedMutex(&FsChangeNotifyListLock); return(STATUS_SUCCESS); } @@ -768,11 +768,11 @@ if (ChangeEntry->DriverObject == DriverObject && ChangeEntry->FSDNotificationProc == FSDNotificationProc) { - ExAcquireFastMutex(&FsChangeNotifyListLock); + KeAcquireGuardedMutex(&FsChangeNotifyListLock); RemoveEntryList(Entry); - ExReleaseFastMutex(&FsChangeNotifyListLock); + KeReleaseGuardedMutex(&FsChangeNotifyListLock); - ExFreePool(Entry); + ExFreePoolWithTag(Entry, TAG_FS_CHANGE_NOTIFY); return; }
19 years, 6 months
1
0
0
0
[weiden] 14999: directly use HeapAlloc/Free in midl_user_allocate and midl_user_free instead of the depreciated GlobalAlloc/Free functions
by weiden@svn.reactos.com
directly use HeapAlloc/Free in midl_user_allocate and midl_user_free instead of the depreciated GlobalAlloc/Free functions Modified: trunk/reactos/lib/advapi32/service/scm.c Modified: trunk/reactos/lib/setupapi/rpc.c Modified: trunk/reactos/services/umpnpmgr/umpnpmgr.c _____ Modified: trunk/reactos/lib/advapi32/service/scm.c --- trunk/reactos/lib/advapi32/service/scm.c 2005-05-05 12:58:03 UTC (rev 14998) +++ trunk/reactos/lib/advapi32/service/scm.c 2005-05-05 13:24:39 UTC (rev 14999) @@ -948,12 +948,12 @@ void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len) { - return GlobalAlloc(GPTR,len); + return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len); } void __RPC_USER midl_user_free(void __RPC_FAR * ptr) { - GlobalFree(ptr); + HeapFree(GetProcessHeap(), 0, ptr); } /* EOF */ _____ Modified: trunk/reactos/lib/setupapi/rpc.c --- trunk/reactos/lib/setupapi/rpc.c 2005-05-05 12:58:03 UTC (rev 14998) +++ trunk/reactos/lib/setupapi/rpc.c 2005-05-05 13:24:39 UTC (rev 14999) @@ -69,14 +69,14 @@ void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len) { - return GlobalAlloc(GPTR, len); + return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len); } void __RPC_USER midl_user_free(void __RPC_FAR * ptr) { - GlobalFree(ptr); + HeapFree(GetProcessHeap(), 0, ptr); } /* EOF */ _____ Modified: trunk/reactos/services/umpnpmgr/umpnpmgr.c --- trunk/reactos/services/umpnpmgr/umpnpmgr.c 2005-05-05 12:58:03 UTC (rev 14998) +++ trunk/reactos/services/umpnpmgr/umpnpmgr.c 2005-05-05 13:24:39 UTC (rev 14999) @@ -103,13 +103,13 @@ void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len) { - return GlobalAlloc(GPTR, len); + return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len); } void __RPC_USER midl_user_free(void __RPC_FAR * ptr) { - GlobalFree(ptr); + HeapFree(GetProcessHeap(), 0, ptr); }
19 years, 6 months
1
0
0
0
← Newer
1
...
68
69
70
71
72
73
74
...
82
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Results per page:
10
25
50
100
200