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
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
June 2017
----- 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
20 participants
526 discussions
Start a n
N
ew thread
[ashaposhnikov] 75211: [RAPPS] * Reduced "installed" check - checks only for the key inself and not the DisplayName. Blazing fast! * Added installed version getter * Added version parser function (...
by ashaposhnikov@svn.reactos.org
Author: ashaposhnikov Date: Mon Jun 26 22:07:43 2017 New Revision: 75211 URL:
http://svn.reactos.org/svn/reactos?rev=75211&view=rev
Log: [RAPPS] * Reduced "installed" check - checks only for the key inself and not the DisplayName. Blazing fast! * Added installed version getter * Added version parser function (without definition yet). Meant to support versions like 1.2.3.4. * rapps.h: Added #pragma once Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/available.cpp branches/GSoC_2017/rapps/reactos/base/applications/rapps/installed.cpp branches/GSoC_2017/rapps/reactos/base/applications/rapps/misc.cpp branches/GSoC_2017/rapps/reactos/base/applications/rapps/rapps.h Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/available.cpp URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/ap…
============================================================================== --- branches/GSoC_2017/rapps/reactos/base/applications/rapps/available.cpp [iso-8859-1] (original) +++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/available.cpp [iso-8859-1] Mon Jun 26 22:07:43 2017 @@ -40,11 +40,14 @@ } } -//App is "installed" if the RegName is in the registry -inline bool _AppInstallCheckKey(PAPPLICATION_INFO Info, REGSAM key) { - return *Info->szRegName - && (IsInstalledApplicationEx(Info->szRegName, TRUE, key) - || IsInstalledApplicationEx(Info->szRegName, FALSE, key)); +//App is "installed" if the RegName or Name is in the registry +inline bool _AppInstallCheckKey(PAPPLICATION_INFO Info, REGSAM key) +{ + return (*Info->szRegName + && (IsInstalledApplication(Info->szRegName, TRUE, key) + || IsInstalledApplication(Info->szRegName, FALSE, key))) + || (*Info->szName && (IsInstalledApplication(Info->szName, TRUE, key) + || IsInstalledApplication(Info->szName, FALSE, key))); } Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/installed.cpp URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/ap…
============================================================================== --- branches/GSoC_2017/rapps/reactos/base/applications/rapps/installed.cpp [iso-8859-1] (original) +++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/installed.cpp [iso-8859-1] Mon Jun 26 22:07:43 2017 @@ -28,50 +28,59 @@ return FALSE; } -BOOL -IsInstalledApplicationEx(LPWSTR lpRegName, BOOL IsUserKey, REGSAM keyWow) -{ - DWORD dwSize = MAX_PATH, dwType; - WCHAR szName[MAX_PATH]; - WCHAR szDisplayName[MAX_PATH]; + + +BOOL +IsInstalledApplication(LPCWSTR lpRegName, BOOL IsUserKey, REGSAM keyWow) +{ + HKEY hKey = NULL; + BOOL IsInstalled = FALSE; + + if ((RegOpenKeyExW(IsUserKey ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE, + L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall", 0, keyWow | KEY_ENUMERATE_SUB_KEYS, + &hKey) == ERROR_SUCCESS) \ + && FindRegistryKeyByName(hKey, keyWow, lpRegName, NULL)) + { + IsInstalled = TRUE; + } + RegCloseKey(hKey); + return IsInstalled; +} + +BOOL +InstalledVersion(LPWSTR szVersionResult, UINT iVersionResultSize, LPCWSTR lpRegName, BOOL IsUserKey, REGSAM keyWow) +{ + DWORD dwSize = MAX_PATH; + DWORD dwType = REG_SZ; + WCHAR szVersion[MAX_PATH]; HKEY hKey, hSubKey; - INT ItemIndex = 0; + BOOL HasVersion = FALSE; + iVersionResultSize = 0; if (RegOpenKeyExW(IsUserKey ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE, - L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall", 0, keyWow | KEY_ENUMERATE_SUB_KEYS, - &hKey) != ERROR_SUCCESS) - { - return FALSE; - } - - while (RegEnumKeyExW(hKey, ItemIndex, szName, &dwSize, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) - { - if (RegOpenKeyExW(hKey, szName, 0, keyWow | KEY_READ, &hSubKey) == ERROR_SUCCESS) + L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall", 0, keyWow | KEY_ENUMERATE_SUB_KEYS, + &hKey) == ERROR_SUCCESS) + { + if (FindRegistryKeyByName(hKey, keyWow, lpRegName, &hSubKey)) { - - dwType = REG_SZ; - dwSize = sizeof(szDisplayName); + dwSize = sizeof(szVersion); if (RegQueryValueExW(hSubKey, - L"DisplayName", - NULL, - &dwType, - (LPBYTE)szDisplayName, - &dwSize) == ERROR_SUCCESS) - { - if (wcscmp(szDisplayName, lpRegName) == 0) - { - RegCloseKey(hSubKey); - RegCloseKey(hKey); - return TRUE; - } + L"DisplayVersion", + NULL, + &dwType, + (LPBYTE) szVersion, + &dwSize) == ERROR_SUCCESS) + { + szVersionResult = szVersion; + iVersionResultSize = dwSize; + HasVersion = TRUE; } } RegCloseKey(hSubKey); - dwSize = MAX_PATH; - ItemIndex++; - } + } + RegCloseKey(hKey); - return FALSE; + return HasVersion; } Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/misc.cpp URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/ap…
============================================================================== --- branches/GSoC_2017/rapps/reactos/base/applications/rapps/misc.cpp [iso-8859-1] (original) +++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/misc.cpp [iso-8859-1] Mon Jun 26 22:07:43 2017 @@ -496,4 +496,28 @@ RtlUnicodeStringToInteger(&BufferW, 0, &Result); return Result; -} +} + + +BOOL +ParseVersion(LPWSTR szVersion, INT* version) +{ + return TRUE; +} + + +//Finds subkey in key by name or path and returns it +BOOL +FindRegistryKeyByName(_In_ HKEY hKeyBase, _In_ REGSAM keyWow, _In_ LPCWSTR lpcKey, _Out_opt_ PHKEY hKeyResult) +{ + HKEY hSubKey; + if (RegOpenKeyExW(hKeyBase, lpcKey, 0, keyWow | KEY_READ, &hSubKey) == ERROR_SUCCESS) + { + hKeyResult = &hSubKey; + return TRUE; + } + hKeyResult = NULL; + RegCloseKey(hSubKey); + return FALSE; +} + Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/rapps.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/ap…
============================================================================== --- branches/GSoC_2017/rapps/reactos/base/applications/rapps/rapps.h [iso-8859-1] (original) +++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/rapps.h [iso-8859-1] Mon Jun 26 22:07:43 2017 @@ -1,3 +1,5 @@ +#pragma once + #ifndef _RAPPS_H #define _RAPPS_H @@ -71,6 +73,7 @@ #define IS_INSTALLED_ENUM(a) (a >= ENUM_INSTALLED_MIN && a <= ENUM_INSTALLED_MAX) #define IS_AVAILABLE_ENUM(a) (a >= ENUM_AVAILABLE_MIN && a <= ENUM_AVAILABLE_MAX) + /* aboutdlg.c */ VOID ShowAboutDialog(VOID); @@ -142,8 +145,10 @@ BOOL GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, LPWSTR lpString); BOOL ShowInstalledAppInfo(INT Index); BOOL UninstallApplication(INT Index, BOOL bModify); -BOOL IsInstalledApplicationEx(LPWSTR lpRegName, BOOL IsUserKey, REGSAM keyWow); +BOOL IsInstalledApplication(LPCWSTR lpRegName, BOOL IsUserKey, REGSAM keyWow); VOID RemoveAppFromRegistry(INT Index); + +BOOL InstalledVersion(LPWSTR szVersionResult, UINT iVersionResultSize, LPCWSTR lpRegName, BOOL IsUserKey, REGSAM keyWow); /* winmain.c */ extern HWND hMainWnd; @@ -176,6 +181,8 @@ UINT ParserGetString(LPCWSTR lpKeyName, LPWSTR lpReturnedString, UINT nSize, LPCWSTR lpFileName); UINT ParserGetInt(LPCWSTR lpKeyName, LPCWSTR lpFileName); +BOOL FindRegistryKeyByName(_In_ HKEY hKeyBase, _In_ REGSAM keyWow, _In_ LPCWSTR lpcKey, _Out_opt_ PHKEY hKeyResult); + /* settingsdlg.c */ VOID CreateSettingsDlg(HWND hwnd);
7 years, 6 months
1
0
0
0
[pschweitzer] 75210: [FASTFAT] - Stop passing DO, directly pass VCB - Try to compute some unique value as internal ID for objects. As MS, return the LBO CORE-13489
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Mon Jun 26 18:10:43 2017 New Revision: 75210 URL:
http://svn.reactos.org/svn/reactos?rev=75210&view=rev
Log: [FASTFAT] - Stop passing DO, directly pass VCB - Try to compute some unique value as internal ID for objects. As MS, return the LBO CORE-13489 Modified: trunk/reactos/drivers/filesystems/fastfat/fastio.c trunk/reactos/drivers/filesystems/fastfat/finfo.c trunk/reactos/drivers/filesystems/fastfat/vfat.h Modified: trunk/reactos/drivers/filesystems/fastfat/fastio.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/fastio.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/fastio.c [iso-8859-1] Mon Jun 26 18:10:43 2017 @@ -142,7 +142,7 @@ Status = VfatGetBasicInformation(FileObject, FCB, - DeviceObject, + DeviceObject->DeviceExtension, Buffer, &BufferLength); Modified: trunk/reactos/drivers/filesystems/fastfat/finfo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/finfo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/finfo.c [iso-8859-1] Mon Jun 26 18:10:43 2017 @@ -125,13 +125,13 @@ VfatGetPositionInformation( PFILE_OBJECT FileObject, PVFATFCB FCB, - PDEVICE_OBJECT DeviceObject, + PDEVICE_EXTENSION DeviceExt, PFILE_POSITION_INFORMATION PositionInfo, PULONG BufferLength) { UNREFERENCED_PARAMETER(FileObject); UNREFERENCED_PARAMETER(FCB); - UNREFERENCED_PARAMETER(DeviceObject); + UNREFERENCED_PARAMETER(DeviceExt); DPRINT("VfatGetPositionInformation()\n"); @@ -239,17 +239,13 @@ VfatGetBasicInformation( PFILE_OBJECT FileObject, PVFATFCB FCB, - PDEVICE_OBJECT DeviceObject, + PDEVICE_EXTENSION DeviceExt, PFILE_BASIC_INFORMATION BasicInfo, PULONG BufferLength) { - PDEVICE_EXTENSION DeviceExt; - UNREFERENCED_PARAMETER(FileObject); DPRINT("VfatGetBasicInformation()\n"); - - DeviceExt = (PDEVICE_EXTENSION)DeviceObject->DeviceExtension; if (*BufferLength < sizeof(FILE_BASIC_INFORMATION)) return STATUS_BUFFER_OVERFLOW; @@ -310,11 +306,9 @@ VfatSetDispositionInformation( PFILE_OBJECT FileObject, PVFATFCB FCB, - PDEVICE_OBJECT DeviceObject, + PDEVICE_EXTENSION DeviceExt, PFILE_DISPOSITION_INFORMATION DispositionInfo) { - PDEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension; - DPRINT("FsdSetDispositionInformation(<%wZ>, Delete %u)\n", &FCB->PathNameU, DispositionInfo->DeleteFile); ASSERT(DeviceExt != NULL); @@ -965,14 +959,14 @@ VfatGetNameInformation( PFILE_OBJECT FileObject, PVFATFCB FCB, - PDEVICE_OBJECT DeviceObject, + PDEVICE_EXTENSION DeviceExt, PFILE_NAME_INFORMATION NameInfo, PULONG BufferLength) { ULONG BytesToCopy; UNREFERENCED_PARAMETER(FileObject); - UNREFERENCED_PARAMETER(DeviceObject); + UNREFERENCED_PARAMETER(DeviceExt); ASSERT(NameInfo != NULL); ASSERT(FCB != NULL); @@ -1009,6 +1003,7 @@ NTSTATUS VfatGetInternalInformation( PVFATFCB Fcb, + PDEVICE_EXTENSION DeviceExt, PFILE_INTERNAL_INFORMATION InternalInfo, PULONG BufferLength) { @@ -1017,8 +1012,9 @@ if (*BufferLength < sizeof(FILE_INTERNAL_INFORMATION)) return STATUS_BUFFER_OVERFLOW; - // FIXME: get a real index, that can be used in a create operation - InternalInfo->IndexNumber.QuadPart = 0; + + InternalInfo->IndexNumber.QuadPart = (LONGLONG)vfatDirEntryGetFirstCluster(DeviceExt, &Fcb->entry) * DeviceExt->FatInfo.BytesPerCluster; + *BufferLength -= sizeof(FILE_INTERNAL_INFORMATION); return STATUS_SUCCESS; } @@ -1107,12 +1103,10 @@ VfatGetEaInformation( PFILE_OBJECT FileObject, PVFATFCB Fcb, - PDEVICE_OBJECT DeviceObject, + PDEVICE_EXTENSION DeviceExt, PFILE_EA_INFORMATION Info, PULONG BufferLength) { - PDEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension; - UNREFERENCED_PARAMETER(FileObject); UNREFERENCED_PARAMETER(Fcb); @@ -1137,7 +1131,7 @@ VfatGetAllInformation( PFILE_OBJECT FileObject, PVFATFCB Fcb, - PDEVICE_OBJECT DeviceObject, + PDEVICE_EXTENSION DeviceExt, PFILE_ALL_INFORMATION Info, PULONG BufferLength) { @@ -1150,28 +1144,28 @@ return STATUS_BUFFER_OVERFLOW; /* Basic Information */ - Status = VfatGetBasicInformation(FileObject, Fcb, DeviceObject, &Info->BasicInformation, BufferLength); + Status = VfatGetBasicInformation(FileObject, Fcb, DeviceExt, &Info->BasicInformation, BufferLength); if (!NT_SUCCESS(Status)) return Status; /* Standard Information */ Status = VfatGetStandardInformation(Fcb, &Info->StandardInformation, BufferLength); if (!NT_SUCCESS(Status)) return Status; /* Internal Information */ - Status = VfatGetInternalInformation(Fcb, &Info->InternalInformation, BufferLength); + Status = VfatGetInternalInformation(Fcb, DeviceExt, &Info->InternalInformation, BufferLength); if (!NT_SUCCESS(Status)) return Status; /* EA Information */ - Status = VfatGetEaInformation(FileObject, Fcb, DeviceObject, &Info->EaInformation, BufferLength); + Status = VfatGetEaInformation(FileObject, Fcb, DeviceExt, &Info->EaInformation, BufferLength); if (!NT_SUCCESS(Status)) return Status; /* Access Information: The IO-Manager adds this information */ *BufferLength -= sizeof(FILE_ACCESS_INFORMATION); /* Position Information */ - Status = VfatGetPositionInformation(FileObject, Fcb, DeviceObject, &Info->PositionInformation, BufferLength); + Status = VfatGetPositionInformation(FileObject, Fcb, DeviceExt, &Info->PositionInformation, BufferLength); if (!NT_SUCCESS(Status)) return Status; /* Mode Information: The IO-Manager adds this information */ *BufferLength -= sizeof(FILE_MODE_INFORMATION); /* Alignment Information: The IO-Manager adds this information */ *BufferLength -= sizeof(FILE_ALIGNMENT_INFORMATION); /* Name Information */ - Status = VfatGetNameInformation(FileObject, Fcb, DeviceObject, &Info->NameInformation, BufferLength); + Status = VfatGetNameInformation(FileObject, Fcb, DeviceExt, &Info->NameInformation, BufferLength); return Status; } @@ -1473,7 +1467,7 @@ case FilePositionInformation: Status = VfatGetPositionInformation(IrpContext->FileObject, FCB, - IrpContext->DeviceObject, + IrpContext->DeviceExt, SystemBuffer, &BufferLength); break; @@ -1481,7 +1475,7 @@ case FileBasicInformation: Status = VfatGetBasicInformation(IrpContext->FileObject, FCB, - IrpContext->DeviceObject, + IrpContext->DeviceExt, SystemBuffer, &BufferLength); break; @@ -1489,13 +1483,14 @@ case FileNameInformation: Status = VfatGetNameInformation(IrpContext->FileObject, FCB, - IrpContext->DeviceObject, + IrpContext->DeviceExt, SystemBuffer, &BufferLength); break; case FileInternalInformation: Status = VfatGetInternalInformation(FCB, + IrpContext->DeviceExt, SystemBuffer, &BufferLength); break; @@ -1510,7 +1505,7 @@ case FileAllInformation: Status = VfatGetAllInformation(IrpContext->FileObject, FCB, - IrpContext->DeviceObject, + IrpContext->DeviceExt, SystemBuffer, &BufferLength); break; @@ -1518,7 +1513,7 @@ case FileEaInformation: Status = VfatGetEaInformation(IrpContext->FileObject, FCB, - IrpContext->DeviceObject, + IrpContext->DeviceExt, SystemBuffer, &BufferLength); break; @@ -1630,7 +1625,7 @@ case FileDispositionInformation: Status = VfatSetDispositionInformation(IrpContext->FileObject, FCB, - IrpContext->DeviceObject, + IrpContext->DeviceExt, SystemBuffer); break; Modified: trunk/reactos/drivers/filesystems/fastfat/vfat.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/vfat.h [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/vfat.h [iso-8859-1] Mon Jun 26 18:10:43 2017 @@ -946,7 +946,7 @@ VfatGetBasicInformation( PFILE_OBJECT FileObject, PVFATFCB FCB, - PDEVICE_OBJECT DeviceObject, + PDEVICE_EXTENSION DeviceExt, PFILE_BASIC_INFORMATION BasicInfo, PULONG BufferLength);
7 years, 6 months
1
0
0
0
[cfinck] 75209: [NETAPI32_APITEST] Fix GCC build
by cfinck@svn.reactos.org
Author: cfinck Date: Mon Jun 26 15:43:58 2017 New Revision: 75209 URL:
http://svn.reactos.org/svn/reactos?rev=75209&view=rev
Log: [NETAPI32_APITEST] Fix GCC build Modified: trunk/rostests/apitests/netapi32/DsRoleGetPrimaryDomainInformation.c Modified: trunk/rostests/apitests/netapi32/DsRoleGetPrimaryDomainInformation.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/netapi32/DsRoleG…
============================================================================== --- trunk/rostests/apitests/netapi32/DsRoleGetPrimaryDomainInformation.c [iso-8859-1] (original) +++ trunk/rostests/apitests/netapi32/DsRoleGetPrimaryDomainInformation.c [iso-8859-1] Mon Jun 26 15:43:58 2017 @@ -20,7 +20,7 @@ // Get information about the domain membership of this computer. dwErrorCode = DsRoleGetPrimaryDomainInformation(NULL, DsRolePrimaryDomainInfoBasic, (PBYTE*)&pInfo); ok(dwErrorCode == ERROR_SUCCESS, "DsRoleGetPrimaryDomainInformation returns %lu!\n", dwErrorCode); - ok(pInfo->MachineRole >= DsRole_RoleStandaloneWorkstation && pInfo->MachineRole <= DsRole_RolePrimaryDomainController, "pInfo->MachineRole is %lu!\n", pInfo->MachineRole); + ok(pInfo->MachineRole >= DsRole_RoleStandaloneWorkstation && pInfo->MachineRole <= DsRole_RolePrimaryDomainController, "pInfo->MachineRole is %u!\n", pInfo->MachineRole); if (pInfo) DsRoleFreeMemory(pInfo);
7 years, 6 months
1
0
0
0
[cfinck] 75208: [NETAPI32_APITEST] Add a simple API Test for netapi32.dll, only covering DsRoleGetPrimaryDomainInformation so far. It succeeds in ReactOS, but outputs a heap error in the debug log....
by cfinck@svn.reactos.org
Author: cfinck Date: Mon Jun 26 15:19:07 2017 New Revision: 75208 URL:
http://svn.reactos.org/svn/reactos?rev=75208&view=rev
Log: [NETAPI32_APITEST] Add a simple API Test for netapi32.dll, only covering DsRoleGetPrimaryDomainInformation so far. It succeeds in ReactOS, but outputs a heap error in the debug log. In real world applications, this later leads to a heap assertion failure. Added: trunk/rostests/apitests/netapi32/ trunk/rostests/apitests/netapi32/CMakeLists.txt (with props) trunk/rostests/apitests/netapi32/DsRoleGetPrimaryDomainInformation.c (with props) trunk/rostests/apitests/netapi32/testlist.c (with props) Modified: trunk/rostests/apitests/CMakeLists.txt Modified: trunk/rostests/apitests/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/CMakeLists.txt?r…
============================================================================== --- trunk/rostests/apitests/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/apitests/CMakeLists.txt [iso-8859-1] Mon Jun 26 15:19:07 2017 @@ -20,6 +20,7 @@ add_subdirectory(localspl) add_subdirectory(msgina) add_subdirectory(msvcrt) +add_subdirectory(netapi32) add_subdirectory(netshell) add_subdirectory(ntdll) add_subdirectory(ole32) Added: trunk/rostests/apitests/netapi32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/netapi32/CMakeLi…
============================================================================== --- trunk/rostests/apitests/netapi32/CMakeLists.txt (added) +++ trunk/rostests/apitests/netapi32/CMakeLists.txt [iso-8859-1] Mon Jun 26 15:19:07 2017 @@ -0,0 +1,10 @@ + +list(APPEND SOURCE + DsRoleGetPrimaryDomainInformation.c + testlist.c) + +add_executable(netapi32_apitest ${SOURCE}) +target_link_libraries(netapi32_apitest wine ${PSEH_LIB}) +set_module_type(netapi32_apitest win32cui) +add_importlibs(netapi32_apitest netapi32 msvcrt kernel32 ntdll) +add_rostests_file(TARGET netapi32_apitest) Propchange: trunk/rostests/apitests/netapi32/CMakeLists.txt ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rostests/apitests/netapi32/DsRoleGetPrimaryDomainInformation.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/netapi32/DsRoleG…
============================================================================== --- trunk/rostests/apitests/netapi32/DsRoleGetPrimaryDomainInformation.c (added) +++ trunk/rostests/apitests/netapi32/DsRoleGetPrimaryDomainInformation.c [iso-8859-1] Mon Jun 26 15:19:07 2017 @@ -0,0 +1,27 @@ +/* + * PROJECT: ReactOS netapi32.dll API Tests + * LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation + * PURPOSE: Tests for DsRoleGetPrimaryDomainInformation + * COPYRIGHT: Copyright 2017 Colin Finck <colin(a)reactos.org> + */ + +#include <apitest.h> + +#define WIN32_NO_STATUS +#include <windef.h> +#include <winbase.h> +#include <dsrole.h> + +START_TEST(DsRoleGetPrimaryDomainInformation) +{ + DWORD dwErrorCode; + PDSROLE_PRIMARY_DOMAIN_INFO_BASIC pInfo = NULL; + + // Get information about the domain membership of this computer. + dwErrorCode = DsRoleGetPrimaryDomainInformation(NULL, DsRolePrimaryDomainInfoBasic, (PBYTE*)&pInfo); + ok(dwErrorCode == ERROR_SUCCESS, "DsRoleGetPrimaryDomainInformation returns %lu!\n", dwErrorCode); + ok(pInfo->MachineRole >= DsRole_RoleStandaloneWorkstation && pInfo->MachineRole <= DsRole_RolePrimaryDomainController, "pInfo->MachineRole is %lu!\n", pInfo->MachineRole); + + if (pInfo) + DsRoleFreeMemory(pInfo); +} Propchange: trunk/rostests/apitests/netapi32/DsRoleGetPrimaryDomainInformation.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rostests/apitests/netapi32/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/netapi32/testlis…
============================================================================== --- trunk/rostests/apitests/netapi32/testlist.c (added) +++ trunk/rostests/apitests/netapi32/testlist.c [iso-8859-1] Mon Jun 26 15:19:07 2017 @@ -0,0 +1,20 @@ +/* + * PROJECT: ReactOS netapi32.dll API Tests + * LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation + * PURPOSE: Test list + * COPYRIGHT: Copyright 2017 Colin Finck <colin(a)reactos.org> + */ + +#define __ROS_LONG64__ + +#define STANDALONE +#include <apitest.h> + +extern void func_DsRoleGetPrimaryDomainInformation(void); + +const struct test winetest_testlist[] = +{ + { "DsRoleGetPrimaryDomainInformation", func_DsRoleGetPrimaryDomainInformation }, + + { 0, 0 } +}; Propchange: trunk/rostests/apitests/netapi32/testlist.c ------------------------------------------------------------------------------ svn:eol-style = native
7 years, 6 months
1
0
0
0
[cfinck] 75207: [PRINTING] - Create the actual generic handle in _LocalOpenPrinterHandle. - Fix _RpcClosePrinter call. - Enable many more tests in winspool_apitest, GetPrinterData. - Bail out with ...
by cfinck@svn.reactos.org
Author: cfinck Date: Mon Jun 26 15:16:46 2017 New Revision: 75207 URL:
http://svn.reactos.org/svn/reactos?rev=75207&view=rev
Log: [PRINTING] - Create the actual generic handle in _LocalOpenPrinterHandle. - Fix _RpcClosePrinter call. - Enable many more tests in winspool_apitest, GetPrinterData. - Bail out with ERROR_INVALID_PARAMETER for empty strings in _MakePrinterSubKey as well. - Add the Name registry value for "Dummy Printer on LPT1" to make a test succeed. This fixes many basic things.. which only got unnoticed, because Printing is only used in the form of API Tests so far. CORE-13458 CORE-13459 Modified: trunk/reactos/boot/bootdata/hivesft.inf trunk/reactos/win32ss/printing/base/winspool/printers.c trunk/reactos/win32ss/printing/providers/localspl/printerdata.c trunk/reactos/win32ss/printing/providers/localspl/printers.c trunk/rostests/apitests/winspool/GetPrinterData.c Modified: trunk/reactos/boot/bootdata/hivesft.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivesft.inf?…
============================================================================== --- trunk/reactos/boot/bootdata/hivesft.inf [iso-8859-1] (original) +++ trunk/reactos/boot/bootdata/hivesft.inf [iso-8859-1] Mon Jun 26 15:16:46 2017 @@ -444,6 +444,7 @@ 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\ 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Dummy Printer On LPT1","Location",,"At Home" +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Dummy Printer On LPT1","Name",,"Dummy Printer On LPT1" HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Dummy Printer On LPT1","Port",,"LPT1:" HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Dummy Printer On LPT1","Print Processor",,"winprint" HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Dummy Printer On LPT1","Printer Driver",,"Dummy Printer Driver" Modified: trunk/reactos/win32ss/printing/base/winspool/printers.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/printing/base/wins…
============================================================================== --- trunk/reactos/win32ss/printing/base/winspool/printers.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/printing/base/winspool/printers.c [iso-8859-1] Mon Jun 26 15:16:46 2017 @@ -235,7 +235,7 @@ // Do the RPC call. RpcTryExcept { - dwErrorCode = _RpcClosePrinter(pHandle->hPrinter); + dwErrorCode = _RpcClosePrinter(&pHandle->hPrinter); } RpcExcept(EXCEPTION_EXECUTE_HANDLER) { Modified: trunk/reactos/win32ss/printing/providers/localspl/printerdata.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/printing/providers…
============================================================================== --- trunk/reactos/win32ss/printing/providers/localspl/printerdata.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/printing/providers/localspl/printerdata.c [iso-8859-1] Mon Jun 26 15:16:46 2017 @@ -25,7 +25,7 @@ PWSTR p; // Sanity check - if (!pKeyName) + if (!pKeyName || !*pKeyName) return ERROR_INVALID_PARAMETER; // Allocate a buffer for the subkey "PrinterName\KeyName". @@ -204,7 +204,7 @@ dwErrorCode = DsRoleGetPrimaryDomainInformation(NULL, DsRolePrimaryDomainInfoBasic, (PBYTE*)&pInfo); if (dwErrorCode != ERROR_SUCCESS) { - ERR("DsRoleGetPrimaryDomainInformation failed with error %lu!\n", GetLastError()); + ERR("DsRoleGetPrimaryDomainInformation failed with error %lu!\n", dwErrorCode); return dwErrorCode; } @@ -216,9 +216,9 @@ else if (wcsicmp(pValueName, SPLREG_DS_PRESENT_FOR_USER) == 0) { DWORD cch; - PWSTR pwszUserSam; PWSTR p; WCHAR wszComputerName[MAX_COMPUTERNAME_LENGTH + 1]; + WCHAR wszUserSam[UNLEN + 1]; // We want to store a REG_DWORD value. *pType = REG_DWORD; @@ -230,47 +230,30 @@ cch = MAX_COMPUTERNAME_LENGTH + 1; if (!GetComputerNameW(wszComputerName, &cch)) { - ERR("GetComputerNameW failed with error %lu!\n", GetLastError()); - return GetLastError(); + dwErrorCode = GetLastError(); + ERR("GetComputerNameW failed with error %lu!\n", dwErrorCode); + return dwErrorCode; } // Get the User Name in the SAM format. // This could either be: // COMPUTERNAME\User // DOMAINNAME\User - cch = 0; - GetUserNameExW(NameSamCompatible, NULL, &cch); - dwErrorCode = GetLastError(); - if (dwErrorCode != ERROR_MORE_DATA) - { - ERR("GetUserNameExW failed with error %lu!\n", dwErrorCode); - return dwErrorCode; - } - - pwszUserSam = DllAllocSplMem(cch * sizeof(WCHAR)); - if (!pwszUserSam) - { - dwErrorCode = ERROR_NOT_ENOUGH_MEMORY; - ERR("DllAllocSplMem failed!\n"); - return dwErrorCode; - } - - if (!GetUserNameExW(NameSamCompatible, pwszUserSam, &cch)) + cch = UNLEN + 1; + if (!GetUserNameExW(NameSamCompatible, wszUserSam, &cch)) { dwErrorCode = GetLastError(); ERR("GetUserNameExW failed with error %lu!\n", dwErrorCode); - DllFreeSplMem(pwszUserSam); return dwErrorCode; } // Terminate the SAM-formatted User Name at the backslash. - p = wcschr(pwszUserSam, L'\\'); + p = wcschr(wszUserSam, L'\\'); *p = 0; // Compare it with the Computer Name. // If they differ, this User is part of a domain. - *((PDWORD)pData) = (wcscmp(pwszUserSam, wszComputerName) != 0); - DllFreeSplMem(pwszUserSam); + *((PDWORD)pData) = (wcscmp(wszUserSam, wszComputerName) != 0); return ERROR_SUCCESS; } else if (wcsicmp(pValueName, SPLREG_REMOTE_FAX) == 0) @@ -328,6 +311,7 @@ DWORD WINAPI LocalGetPrinterDataEx(HANDLE hPrinter, PCWSTR pKeyName, PCWSTR pValueName, PDWORD pType, PBYTE pData, DWORD nSize, PDWORD pcbNeeded) { + BYTE Temp; DWORD dwErrorCode; DWORD dwTemp; PLOCAL_HANDLE pHandle = (PLOCAL_HANDLE)hPrinter; @@ -337,6 +321,12 @@ // Ensure here that it is always set to simplify the code later. if (!pType) pType = &dwTemp; + + // pData is later fed to RegQueryValueExW in many cases. When calling it with zero buffer size, RegQueryValueExW returns a + // different error code based on whether pData is NULL or something else. + // Ensure here that ERROR_MORE_DATA is always returned. + if (!pData) + pData = &Temp; if (!pHandle) { Modified: trunk/reactos/win32ss/printing/providers/localspl/printers.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/printing/providers…
============================================================================== --- trunk/reactos/win32ss/printing/providers/localspl/printers.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/printing/providers/localspl/printers.c [iso-8859-1] Mon Jun 26 15:16:46 2017 @@ -1106,6 +1106,15 @@ goto Failure; } + // Create a new generic handle. + pHandle = DllAllocSplMem(sizeof(LOCAL_HANDLE)); + if (!pHandle) + { + dwErrorCode = ERROR_NOT_ENOUGH_MEMORY; + ERR("DllAllocSplMem failed!\n"); + goto Failure; + } + // Create a new LOCAL_PRINTER_HANDLE. pPrinterHandle = DllAllocSplMem(sizeof(LOCAL_PRINTER_HANDLE)); if (!pPrinterHandle) @@ -1192,7 +1201,7 @@ pPrinterHandle->pJob = pJob; } - // Make the generic handle a Port handle. + // Make the generic handle a Printer handle. pHandle->HandleType = HandleType_Printer; pHandle->pSpecificHandle = pPrinterHandle; Modified: trunk/rostests/apitests/winspool/GetPrinterData.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/winspool/GetPrin…
============================================================================== --- trunk/rostests/apitests/winspool/GetPrinterData.c [iso-8859-1] (original) +++ trunk/rostests/apitests/winspool/GetPrinterData.c [iso-8859-1] Mon Jun 26 15:16:46 2017 @@ -28,7 +28,6 @@ SPLREG_VALUE, *PSPLREG_VALUE; SPLREG_VALUE SplRegValues[] = { -#if 0 { "DefaultSpoolDirectory", L"DefaultSpoolDirectory", REG_SZ, 0xFFFFFFFF, TRUE }, { "PortThreadPriorityDefault", L"PortThreadPriorityDefault", REG_NONE, 4, FALSE }, { "PortThreadPriority", L"PortThreadPriority", REG_DWORD, 4, TRUE }, @@ -50,6 +49,7 @@ { "Architecture", L"Architecture", REG_NONE, 0xFFFFFFFF, FALSE }, { "OSVersion", L"OSVersion", REG_NONE, sizeof(OSVERSIONINFOA), FALSE }, { "OSVersionEx", L"OSVersionEx", REG_NONE, sizeof(OSVERSIONINFOEXA), FALSE }, +#if 0 { "DsPresent", L"DsPresent", REG_DWORD, 4, FALSE }, { "DsPresentForUser", L"DsPresentForUser", REG_DWORD, 4, FALSE }, #endif
7 years, 6 months
1
0
0
0
[cfinck] 75206: [ADVAPI32_APITEST] Fix copy-paste mistakes in messages.
by cfinck@svn.reactos.org
Author: cfinck Date: Mon Jun 26 15:10:27 2017 New Revision: 75206 URL:
http://svn.reactos.org/svn/reactos?rev=75206&view=rev
Log: [ADVAPI32_APITEST] Fix copy-paste mistakes in messages. Modified: trunk/rostests/apitests/advapi32/RegQueryValueExW.c Modified: trunk/rostests/apitests/advapi32/RegQueryValueExW.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/RegQuer…
============================================================================== --- trunk/rostests/apitests/advapi32/RegQueryValueExW.c [iso-8859-1] (original) +++ trunk/rostests/apitests/advapi32/RegQueryValueExW.c [iso-8859-1] Mon Jun 26 15:10:27 2017 @@ -253,7 +253,7 @@ ret = RegQueryValueExW(hkey_main, L"LONGSTRING", NULL, &type, (LPBYTE)data22, &size); ok(ret == ERROR_MORE_DATA, "RegQueryValueExW returned: %lx\n", ret); ok(GetLastError() == 0xdeadbeef, "RegQueryValueExW returned: %lx\n", GetLastError()); - ok(type == REG_SZ, "Expected REG_NONE, Type is: %ld\n", type); + ok(type == REG_SZ, "Expected REG_SZ, Type is: %ld\n", type); ok(size == 46, "Expected size = 46, size is: %ld\n", size); ok(wcscmp(data22, string22W), "Expected being different!"); @@ -264,7 +264,7 @@ ret = RegQueryValueExW(hkey_main, L"LONGSTRING", NULL, &type, (LPBYTE)data23, &size); ok(ret == ERROR_SUCCESS, "RegQueryValueExW returned: %lx\n", ret); ok(GetLastError() == 0xdeadbeef, "RegQueryValueExW returned: %lx\n", GetLastError()); - ok(type == REG_SZ, "Expected REG_NONE, Type is: %ld\n", type); + ok(type == REG_SZ, "Expected REG_SZ, Type is: %ld\n", type); ok(size == 46, "Expected size = 46, size is: %ld", size); ok(!wcscmp(data23,string22W), "Expected same string! data23: %S, string22W: %S", data23, string22W); @@ -275,7 +275,7 @@ ret = RegQueryValueExW(hkey_main, L"LONGSTRING", NULL, &type, (LPBYTE)data24, &size); ok(ret == ERROR_SUCCESS, "RegQueryValueExW returned: %lx\n", ret); ok(GetLastError() == 0xdeadbeef, "RegQueryValueExW returned: %lx\n", GetLastError()); - ok(type == REG_SZ, "Expected REG_NONE, Type is: %ld\n", type); + ok(type == REG_SZ, "Expected REG_SZ, Type is: %ld\n", type); ok(size == 46, "Expected size = 46, size is: %ld\n", size); ok(!wcscmp(data24, string22W), "Expected same string! data24: %S, string22W: %S\n", data24, string22W); @@ -287,7 +287,7 @@ ret = RegQueryValueExW(hkey_main, L"LONGSTRING", NULL, &type, (LPBYTE)data23, &size); ok(ret == ERROR_MORE_DATA, "RegQueryValueExW returned: %lx\n", ret); ok(GetLastError() == 0xdeadbeef, "RegQueryValueExW returned: %lx\n", GetLastError()); - ok(type == REG_SZ, "Expected REG_NONE, Type is: %ld\n", type); + ok(type == REG_SZ, "Expected REG_SZ, Type is: %ld\n", type); ok(size == 46, "Expected size = 46, size is: %ld", size); ok(wcscmp(data23, string22W), "Expected different string!\n"); @@ -299,7 +299,7 @@ ret = RegQueryValueExW(hkey_main, L"LONGSTRING", NULL, &type, (LPBYTE)data23, &size); ok(ret == ERROR_SUCCESS, "RegQueryValueExW returned: %lx\n", ret); ok(GetLastError() == 0xdeadbeef, "RegQueryValueExW returned: %lx\n", GetLastError()); - ok(type == REG_SZ, "Expected REG_NONE, Type is: %ld\n", type); + ok(type == REG_SZ, "Expected REG_SZ, Type is: %ld\n", type); ok(size == 46, "Expected size = 46, size is: %ld", size); ok(!wcscmp(data23, string22W), "Expected same string! data23: %S, string22W: %S", data23, string22W);
7 years, 6 months
1
0
0
0
[mjansen] 75205: [APPHELP_APITEST] Add tests for SdbGetMatchingExe, to test matching on version resources. CORE-13284
by mjansen@svn.reactos.org
Author: mjansen Date: Mon Jun 26 14:58:08 2017 New Revision: 75205 URL:
http://svn.reactos.org/svn/reactos?rev=75205&view=rev
Log: [APPHELP_APITEST] Add tests for SdbGetMatchingExe, to test matching on version resources. CORE-13284 Added: trunk/rostests/apitests/apphelp/testdata.rc (with props) trunk/rostests/apitests/apphelp/testdb.xml (with props) Modified: trunk/rostests/apitests/apphelp/CMakeLists.txt trunk/rostests/apitests/apphelp/db.cpp Modified: trunk/rostests/apitests/apphelp/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apphelp/CMakeLis…
============================================================================== --- trunk/rostests/apitests/apphelp/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/apitests/apphelp/CMakeLists.txt [iso-8859-1] Mon Jun 26 14:58:08 2017 @@ -1,5 +1,7 @@ project(appcompat) add_definitions(-D__ROS_LONG64__ -DWINETEST_USE_DBGSTR_LONGLONG) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) list(APPEND SOURCE apphelp.c @@ -7,8 +9,16 @@ db.cpp env.c layerapi.c - testlist.c) + testlist.c + testdata.rc + testdb.xml) +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/testdb.sdb + COMMAND native-xml2sdb -i ${CMAKE_CURRENT_SOURCE_DIR}/testdb.xml -o ${CMAKE_CURRENT_BINARY_DIR}/testdb.sdb + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/testdb.xml native-xml2sdb) + +add_custom_target(testdb DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/testdb.sdb) +add_rc_deps(testdata.rc testdb) add_executable(apphelp_apitest ${SOURCE}) set_module_type(apphelp_apitest win32cui) target_link_libraries(apphelp_apitest ${PSEH_LIB}) Modified: trunk/rostests/apitests/apphelp/db.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apphelp/db.cpp?r…
============================================================================== --- trunk/rostests/apitests/apphelp/db.cpp [iso-8859-1] (original) +++ trunk/rostests/apitests/apphelp/db.cpp [iso-8859-1] Mon Jun 26 14:58:08 2017 @@ -1332,6 +1332,147 @@ ok(ret, "RemoveDirectoryW error: %d\n", GetLastError()); } +static BOOL write_raw_file(const WCHAR* FileName, const void* Data, DWORD Size) +{ + BOOL Success; + DWORD dwWritten; + HANDLE Handle = CreateFileW(FileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + + if (Handle == INVALID_HANDLE_VALUE) + { + skip("Failed to create temp file %ls, error %u\n", FileName, GetLastError()); + return FALSE; + } + Success = WriteFile(Handle, Data, Size, &dwWritten, NULL); + ok(Success == TRUE, "WriteFile failed with %u\n", GetLastError()); + ok(dwWritten == Size, "WriteFile wrote %u bytes instead of %u\n", dwWritten, Size); + CloseHandle(Handle); + return Success && (dwWritten == Size); +} + +static bool extract_resource(const WCHAR* Filename, LPCWSTR ResourceName) +{ + HMODULE hMod = GetModuleHandleW(NULL); + HRSRC hRsrc = FindResourceW(hMod, ResourceName, MAKEINTRESOURCEW(RT_RCDATA)); + ok(!!hRsrc, "Unable to find %s\n", wine_dbgstr_w(ResourceName)); + if (!hRsrc) + return false; + + HGLOBAL hGlobal = LoadResource(hMod, hRsrc); + DWORD Size = SizeofResource(hMod, hRsrc); + LPVOID pData = LockResource(hGlobal); + + ok(Size && !!pData, "Unable to load %s\n", wine_dbgstr_w(ResourceName)); + if (!Size || !pData) + return false; + + BOOL Written = write_raw_file(Filename, pData, Size); + UnlockResource(pData); + return Written; +} + +template<typename SDBQUERYRESULT_T> +static BOOL test_match_ex(const WCHAR* workdir, HSDB hsdb, int cur) +{ + WCHAR exename[MAX_PATH]; + WCHAR* Vendor; + SDBQUERYRESULT_T query; + TAGID tagid, exetag; + BOOL ret, Succeed; + PDB pdb; + + memset(&query, 0xab, sizeof(query)); + + swprintf(exename, L"%s\\test_match%d.exe", workdir, cur); + + ret = pSdbTagRefToTagID(hsdb, 0, &pdb, &tagid); + ok(pdb != NULL && pdb != (PDB)0x12345678, "Expected pdb to be set to a valid pdb, was: %p\n", pdb); + + tagid = pSdbFindFirstTag(pdb, TAGID_ROOT, TAG_DATABASE); + ok(tagid != TAGID_NULL, "Expected to get a valid TAG_DATABASE\n"); + + exetag = pSdbFindFirstNamedTag(pdb, tagid, TAG_EXE, TAG_NAME, exename + wcslen(workdir) + 1); + + if (!exetag) + { + /* Test done */ + return FALSE; + } + + tagid = pSdbFindFirstTag(pdb, exetag, TAG_VENDOR); + Vendor = pSdbGetStringTagPtr(pdb, tagid); + Succeed = tagid != TAGID_NULL && Vendor && !wcsicmp(Vendor, L"Succeed"); + + test_create_exe(exename, 0); + + ret = pSdbGetMatchingExe(hsdb, exename, NULL, NULL, 0, (SDBQUERYRESULT_VISTA*)&query); + DWORD exe_count = Succeed ? 1 : 0; + + if (Succeed) + ok(ret, "SdbGetMatchingExe should not fail for %d.\n", cur); + else + ok(!ret, "SdbGetMatchingExe should not succeed for %d.\n", cur); + + ok(query.dwExeCount == exe_count, "Expected dwExeCount to be %d, was %d for %d\n", exe_count, query.dwExeCount, cur); + DeleteFileW(exename); + /* Try the next file */ + return TRUE; +} + + +template<typename SDBQUERYRESULT_T> +static void test_MatchApplicationsEx(void) +{ + WCHAR workdir[MAX_PATH], dbpath[MAX_PATH]; + BOOL ret; + HSDB hsdb; + + ret = GetTempPathW(_countof(workdir), workdir); + ok(ret, "GetTempPathW error: %d\n", GetLastError()); + lstrcatW(workdir, L"apphelp_test"); + + ret = CreateDirectoryW(workdir, NULL); + ok(ret, "CreateDirectoryW error: %d\n", GetLastError()); + + /* SdbInitDatabase needs an nt-path */ + swprintf(dbpath, L"\\??\\%s\\test.sdb", workdir); + + if (extract_resource(dbpath + 4, MAKEINTRESOURCEW(101))) + { + hsdb = pSdbInitDatabase(HID_DATABASE_FULLPATH, dbpath); + + ok(hsdb != NULL, "Expected a valid database handle\n"); + + if (!hsdb) + { + skip("SdbInitDatabase not implemented?\n"); + } + else + { + size_t n; + /* now that our enviroment is setup, let's go ahead and run the actual tests.. */ + for (n = 0;; ++n) + { + if (!test_match_ex<SDBQUERYRESULT_T>(workdir, hsdb, n)) + break; + } + pSdbReleaseDatabase(hsdb); + } + } + else + { + ok(0, "Unable to extract database\n"); + } + + DeleteFileW(dbpath + 4); + + ret = RemoveDirectoryW(workdir); + ok(ret, "RemoveDirectoryW error: %d\n", GetLastError()); +} + + + + static void test_TagRef(void) { WCHAR tmpdir[MAX_PATH], dbpath[MAX_PATH]; @@ -1660,9 +1801,11 @@ { case 1: test_MatchApplications<SDBQUERYRESULT_2k3>(); + test_MatchApplicationsEx<SDBQUERYRESULT_2k3>(); break; case 2: test_MatchApplications<SDBQUERYRESULT_VISTA>(); + test_MatchApplicationsEx<SDBQUERYRESULT_VISTA>(); break; default: skip("Skipping tests with SDBQUERYRESULT due to a wrong size reported\n"); Added: trunk/rostests/apitests/apphelp/testdata.rc URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apphelp/testdata…
============================================================================== --- trunk/rostests/apitests/apphelp/testdata.rc (added) +++ trunk/rostests/apitests/apphelp/testdata.rc [iso-8859-1] Mon Jun 26 14:58:08 2017 @@ -0,0 +1,2 @@ + +101 RCDATA "testdb.sdb" Propchange: trunk/rostests/apitests/apphelp/testdata.rc ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rostests/apitests/apphelp/testdb.xml URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apphelp/testdb.x…
============================================================================== --- trunk/rostests/apitests/apphelp/testdb.xml (added) +++ trunk/rostests/apitests/apphelp/testdb.xml [iso-8859-1] Mon Jun 26 14:58:08 2017 @@ -0,0 +1,235 @@ +<SDB> + <DATABASE> + <NAME>ReactOS test database</NAME> + <OS_PLATFORM >1</OS_PLATFORM> + <DATABASE_ID>{551F8E78-A9DA-44AC-A24C-5A8145317BC7}</DATABASE_ID> + <LIBRARY> + </LIBRARY> + + <!-- Verify that we are able to match this --> + <EXE> + <NAME>test_match0.exe</NAME> + <APP_NAME>Generic name</APP_NAME> + <VENDOR>Succeed</VENDOR> + <MATCHING_FILE> + <NAME>*</NAME> + <SIZE>2048</SIZE> + <CHECKSUM>0x178BD629</CHECKSUM> + <PRODUCT_VERSION>1.0.0.1</PRODUCT_VERSION> + <!-- BIN_PRODUCT_VERSION? --> + <FILE_VERSION>1.0.0.0</FILE_VERSION> + <!-- BIN_FILE_VERSION? --> + <FILE_DESCRIPTION>FileDescription</FILE_DESCRIPTION> + <COMPANY_NAME>CompanyName</COMPANY_NAME> + <ORIGINAL_FILENAME>OriginalFilename</ORIGINAL_FILENAME> + <INTERNAL_NAME>InternalName</INTERNAL_NAME> + </MATCHING_FILE> + </EXE> + <!-- Verify that we are able to match this --> + <EXE> + <NAME>test_match1.exe</NAME> + <APP_NAME>Generic name</APP_NAME> + <VENDOR>Succeed</VENDOR> + <MATCHING_FILE> + <NAME>*</NAME> + <SIZE>2048</SIZE> + <CHECKSUM>0x178BD629</CHECKSUM> + <PRODUCT_VERSION>1.0.0.1</PRODUCT_VERSION> + <!-- BIN_PRODUCT_VERSION? --> + <FILE_VERSION>1.0.0.0</FILE_VERSION> + <!-- BIN_FILE_VERSION? --> + <FILE_DESCRIPTION>FILEDESCRIPTION</FILE_DESCRIPTION> + <COMPANY_NAME>companyname</COMPANY_NAME> + <ORIGINAL_FILENAME>ORIGINALFILENAME</ORIGINAL_FILENAME> + <INTERNAL_NAME>internalname</INTERNAL_NAME> + </MATCHING_FILE> + </EXE> + <!-- SIZE wrong --> + <EXE> + <NAME>test_match2.exe</NAME> + <APP_NAME>Generic name</APP_NAME> + <VENDOR>Generic Description</VENDOR> + <MATCHING_FILE> + <NAME>*</NAME> + <SIZE>2047</SIZE> + <CHECKSUM>0x178BD629</CHECKSUM> + <PRODUCT_VERSION>1.0.0.1</PRODUCT_VERSION> + <FILE_VERSION>1.0.0.0</FILE_VERSION> + <FILE_DESCRIPTION>FileDescription</FILE_DESCRIPTION> + <COMPANY_NAME>CompanyName</COMPANY_NAME> + <ORIGINAL_FILENAME>OriginalFilename</ORIGINAL_FILENAME> + <INTERNAL_NAME>InternalName</INTERNAL_NAME> + </MATCHING_FILE> + </EXE> + <!-- CHECKSUM wrong --> + <EXE> + <NAME>test_match3.exe</NAME> + <APP_NAME>Generic name</APP_NAME> + <VENDOR>Generic Description</VENDOR> + <MATCHING_FILE> + <NAME>*</NAME> + <SIZE>2048</SIZE> + <CHECKSUM>0x111111</CHECKSUM> + <PRODUCT_VERSION>1.0.0.1</PRODUCT_VERSION> + <FILE_VERSION>1.0.0.0</FILE_VERSION> + <FILE_DESCRIPTION>FileDescription</FILE_DESCRIPTION> + <COMPANY_NAME>CompanyName</COMPANY_NAME> + <ORIGINAL_FILENAME>OriginalFilename</ORIGINAL_FILENAME> + <INTERNAL_NAME>InternalName</INTERNAL_NAME> + </MATCHING_FILE> + </EXE> + <!-- PRODUCT_VERSION too high --> + <EXE> + <NAME>test_match4.exe</NAME> + <APP_NAME>Generic name</APP_NAME> + <VENDOR>Generic Description</VENDOR> + <MATCHING_FILE> + <NAME>*</NAME> + <SIZE>2048</SIZE> + <CHECKSUM>0x178BD629</CHECKSUM> + <PRODUCT_VERSION>1.1.1.1</PRODUCT_VERSION> + <FILE_VERSION>1.0.0.0</FILE_VERSION> + <FILE_DESCRIPTION>FileDescription</FILE_DESCRIPTION> + <COMPANY_NAME>CompanyName</COMPANY_NAME> + <ORIGINAL_FILENAME>OriginalFilename</ORIGINAL_FILENAME> + <INTERNAL_NAME>InternalName</INTERNAL_NAME> + </MATCHING_FILE> + </EXE> + <!-- PRODUCT_VERSION too low --> + <EXE> + <NAME>test_match5.exe</NAME> + <APP_NAME>Generic name</APP_NAME> + <VENDOR>Generic Description</VENDOR> + <MATCHING_FILE> + <NAME>*</NAME> + <SIZE>2048</SIZE> + <CHECKSUM>0x178BD629</CHECKSUM> + <PRODUCT_VERSION>1.0.0.0</PRODUCT_VERSION> + <FILE_VERSION>1.0.0.0</FILE_VERSION> + <FILE_DESCRIPTION>FileDescription</FILE_DESCRIPTION> + <COMPANY_NAME>CompanyName</COMPANY_NAME> + <ORIGINAL_FILENAME>OriginalFilename</ORIGINAL_FILENAME> + <INTERNAL_NAME>InternalName</INTERNAL_NAME> + </MATCHING_FILE> + </EXE> + <!-- FILE_VERSION wrong --> + <EXE> + <NAME>test_match6.exe</NAME> + <APP_NAME>Generic name</APP_NAME> + <VENDOR>Generic Description</VENDOR> + <MATCHING_FILE> + <NAME>*</NAME> + <SIZE>2048</SIZE> + <CHECKSUM>0x178BD629</CHECKSUM> + <PRODUCT_VERSION>1.0.0.1</PRODUCT_VERSION> + <FILE_VERSION>1.1.1.1</FILE_VERSION> + <FILE_DESCRIPTION>FileDescription</FILE_DESCRIPTION> + <COMPANY_NAME>CompanyName</COMPANY_NAME> + <ORIGINAL_FILENAME>OriginalFilename</ORIGINAL_FILENAME> + <INTERNAL_NAME>InternalName</INTERNAL_NAME> + </MATCHING_FILE> + </EXE> + <!-- FILE_DESCRIPTION wrong --> + <EXE> + <NAME>test_match7.exe</NAME> + <APP_NAME>Generic name</APP_NAME> + <VENDOR>Generic Description</VENDOR> + <MATCHING_FILE> + <NAME>*</NAME> + <SIZE>2048</SIZE> + <CHECKSUM>0x178BD629</CHECKSUM> + <PRODUCT_VERSION>1.0.0.1</PRODUCT_VERSION> + <FILE_VERSION>1.0.0.0</FILE_VERSION> + <FILE_DESCRIPTION>Wrong Description</FILE_DESCRIPTION> + <COMPANY_NAME>CompanyName</COMPANY_NAME> + <ORIGINAL_FILENAME>OriginalFilename</ORIGINAL_FILENAME> + <INTERNAL_NAME>InternalName</INTERNAL_NAME> + </MATCHING_FILE> + </EXE> + <!-- COMPANY_NAME wrong --> + <EXE> + <NAME>test_match8.exe</NAME> + <APP_NAME>Generic name</APP_NAME> + <VENDOR>Generic Description</VENDOR> + <MATCHING_FILE> + <NAME>*</NAME> + <SIZE>2048</SIZE> + <CHECKSUM>0x178BD629</CHECKSUM> + <PRODUCT_VERSION>1.0.0.1</PRODUCT_VERSION> + <FILE_VERSION>1.0.0.0</FILE_VERSION> + <FILE_DESCRIPTION>FileDescription</FILE_DESCRIPTION> + <COMPANY_NAME>Wrong CompanyName</COMPANY_NAME> + <ORIGINAL_FILENAME>OriginalFilename</ORIGINAL_FILENAME> + <INTERNAL_NAME>InternalName</INTERNAL_NAME> + </MATCHING_FILE> + </EXE> + <!-- ORIGINAL_FILENAME wrong --> + <EXE> + <NAME>test_match9.exe</NAME> + <APP_NAME>Generic name</APP_NAME> + <VENDOR>Generic Description</VENDOR> + <MATCHING_FILE> + <NAME>*</NAME> + <SIZE>2048</SIZE> + <CHECKSUM>0x178BD629</CHECKSUM> + <PRODUCT_VERSION>1.0.0.1</PRODUCT_VERSION> + <FILE_VERSION>1.0.0.0</FILE_VERSION> + <FILE_DESCRIPTION>FileDescription</FILE_DESCRIPTION> + <COMPANY_NAME>CompanyName</COMPANY_NAME> + <ORIGINAL_FILENAME>Wrong OriginalFilename</ORIGINAL_FILENAME> + <INTERNAL_NAME>InternalName</INTERNAL_NAME> + </MATCHING_FILE> + </EXE> + <!-- INTERNAL_NAME wrong --> + <EXE> + <NAME>test_match10.exe</NAME> + <APP_NAME>Generic name</APP_NAME> + <VENDOR>Generic Description</VENDOR> + <MATCHING_FILE> + <NAME>*</NAME> + <SIZE>2048</SIZE> + <CHECKSUM>0x178BD629</CHECKSUM> + <PRODUCT_VERSION>1.0.0.1</PRODUCT_VERSION> + <FILE_VERSION>1.0.0.0</FILE_VERSION> + <FILE_DESCRIPTION>FileDescription</FILE_DESCRIPTION> + <COMPANY_NAME>CompanyName</COMPANY_NAME> + <ORIGINAL_FILENAME>OriginalFilename</ORIGINAL_FILENAME> + <INTERNAL_NAME>wrong InternalName</INTERNAL_NAME> + </MATCHING_FILE> + </EXE> + <!-- Show that strings are checked for the full length(1) --> + <EXE> + <NAME>test_match11.exe</NAME> + <APP_NAME>Generic name</APP_NAME> + <VENDOR>Generic Description</VENDOR> + <MATCHING_FILE> + <NAME>*</NAME> + <SIZE>2048</SIZE> + <CHECKSUM>0x178BD629</CHECKSUM> + <PRODUCT_VERSION>1.0.0.1</PRODUCT_VERSION> + <FILE_VERSION>1.0.0.0</FILE_VERSION> + <FILE_DESCRIPTION>FileDescription</FILE_DESCRIPTION> + <COMPANY_NAME>CompanyName</COMPANY_NAME> + <ORIGINAL_FILENAME>OriginalFilename</ORIGINAL_FILENAME> + <INTERNAL_NAME>InternalName wrong</INTERNAL_NAME> + </MATCHING_FILE> + </EXE> + <!-- Show that strings are checked for the full length(2) --> + <EXE> + <NAME>test_match12.exe</NAME> + <APP_NAME>Generic name</APP_NAME> + <VENDOR>Generic Description</VENDOR> + <MATCHING_FILE> + <NAME>*</NAME> + <SIZE>2048</SIZE> + <CHECKSUM>0x178BD629</CHECKSUM> + <PRODUCT_VERSION>1.0.0.1</PRODUCT_VERSION> + <FILE_VERSION>1.0.0.0</FILE_VERSION> + <FILE_DESCRIPTION>FileDescription</FILE_DESCRIPTION> + <COMPANY_NAME>CompanyName</COMPANY_NAME> + <ORIGINAL_FILENAME>OriginalFilename</ORIGINAL_FILENAME> + <INTERNAL_NAME>Internal</INTERNAL_NAME> + </MATCHING_FILE> + </EXE> + </DATABASE> +</SDB> Propchange: trunk/rostests/apitests/apphelp/testdb.xml ------------------------------------------------------------------------------ svn:eol-style = native
7 years, 6 months
1
0
0
0
[mjansen] 75204: Missing functions
by mjansen@svn.reactos.org
Author: mjansen Date: Mon Jun 26 12:50:46 2017 New Revision: 75204 URL:
http://svn.reactos.org/svn/reactos?rev=75204&view=rev
Log: Missing functions Modified: trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h Modified: trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/xml2sdb/xml2sdb.…
============================================================================== --- trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h [iso-8859-1] Mon Jun 26 12:50:46 2017 @@ -141,6 +141,18 @@ return FindShimTagid(sdbstring(name.begin(), name.end())); } + + void InsertPatchTagid(const sdbstring& name, TAGID tagid); + inline void InsertPatchTagid(const std::string& name, TAGID tagid) + { + InsertPatchTagid(sdbstring(name.begin(), name.end()), tagid); + } + TAGID FindPatchTagid(const sdbstring& name); + inline TAGID FindPatchTagid(const std::string& name) + { + return FindPatchTagid(sdbstring(name.begin(), name.end())); + } + std::string Name; GUID ID;
7 years, 6 months
1
0
0
0
[mjansen] 75203: Missing include
by mjansen@svn.reactos.org
Author: mjansen Date: Mon Jun 26 12:47:08 2017 New Revision: 75203 URL:
http://svn.reactos.org/svn/reactos?rev=75203&view=rev
Log: Missing include Modified: trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h Modified: trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/xml2sdb/xml2sdb.…
============================================================================== --- trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h [iso-8859-1] Mon Jun 26 12:47:08 2017 @@ -2,6 +2,7 @@ #include <string> #include <list> +#include <vector> #include <map> #include <typedefs.h>
7 years, 6 months
1
0
0
0
[mjansen] 75202: [SDK][XML2SDB] Simplify helper functions, output Exe matches + file attributes
by mjansen@svn.reactos.org
Author: mjansen Date: Mon Jun 26 12:45:01 2017 New Revision: 75202 URL:
http://svn.reactos.org/svn/reactos?rev=75202&view=rev
Log: [SDK][XML2SDB] Simplify helper functions, output Exe matches + file attributes Modified: trunk/reactos/sdk/tools/xml2sdb/CMakeLists.txt trunk/reactos/sdk/tools/xml2sdb/main.cpp trunk/reactos/sdk/tools/xml2sdb/xml2sdb.cpp trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h Modified: trunk/reactos/sdk/tools/xml2sdb/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/xml2sdb/CMakeLis…
============================================================================== --- trunk/reactos/sdk/tools/xml2sdb/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/xml2sdb/CMakeLists.txt [iso-8859-1] Mon Jun 26 12:45:01 2017 @@ -5,6 +5,7 @@ main.cpp tinyxml2.cpp xml2sdb.cpp + xml2sdb.h ${REACTOS_SOURCE_DIR}/dll/appcompat/apphelp/sdbwrite.c ${REACTOS_SOURCE_DIR}/dll/appcompat/apphelp/sdbstringtable.c) Modified: trunk/reactos/sdk/tools/xml2sdb/main.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/xml2sdb/main.cpp…
============================================================================== --- trunk/reactos/sdk/tools/xml2sdb/main.cpp [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/xml2sdb/main.cpp [iso-8859-1] Mon Jun 26 12:45:01 2017 @@ -186,14 +186,19 @@ static std::string get_strarg(int argc, char* argv[], int& i) { - if (argv[i][2] == 0) - { - ++i; - if (i >= argc || !argv[i]) - return std::string(); - return argv[i]; - } - return std::string(argv[i] + 2); + if (argv[i][2] != 0) + return std::string(argv[i] + 2); + + ++i; + if (i >= argc || !argv[i]) + return std::string(); + return argv[i]; +} + +static void update_loglevel(int argc, char* argv[], int& i) +{ + std::string value = get_strarg(argc, argv, i); + g_ShimDebugLevel = strtoul(value.c_str(), NULL, 10); } // -i R:\src\apphelp\reactos\media\sdb\sysmain.xml -oR:\build\apphelp\devenv_msvc\media\sdb\ros2.sdb @@ -204,25 +209,28 @@ for (int i = 1; i < argc; ++i) { - if (argv[i][0] == '/' || argv[i][0] == '-') + if (argv[i][0] != '/' && argv[i][0] != '-') + continue; + + switch(argv[i][1]) { - switch(argv[i][1]) - { - case 'i': - input = get_strarg(argc, argv, i); - break; - case 'o': - output = get_strarg(argc, argv, i); - break; - } - if (!input.empty() && !output.empty()) - { - if (!run_one(input, output)) - { - printf("Failed converting '%s' to '%s'\n", input.c_str(), output.c_str()); - return 1; - } - } + case 'i': + input = get_strarg(argc, argv, i); + break; + case 'o': + output = get_strarg(argc, argv, i); + break; + case 'l': + update_loglevel(argc, argv, i); + break; + } + if (input.empty() || output.empty()) + continue; + + if (!run_one(input, output)) + { + printf("Failed converting '%s' to '%s'\n", input.c_str(), output.c_str()); + return 1; } } return 0; Modified: trunk/reactos/sdk/tools/xml2sdb/xml2sdb.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/xml2sdb/xml2sdb.…
============================================================================== --- trunk/reactos/sdk/tools/xml2sdb/xml2sdb.cpp [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/xml2sdb/xml2sdb.cpp [iso-8859-1] Mon Jun 26 12:45:01 2017 @@ -2,7 +2,7 @@ * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS xml to sdb converter * FILE: sdk/tools/xml2sdb/xml2sdb.cpp - * PURPOSE: Main conversion functions from xml -> db + * PURPOSE: Conversion functions from xml -> db * PROGRAMMERS: Mark Jansen * */ @@ -16,6 +16,7 @@ using tinyxml2::XMLText; static const GUID GUID_NULL = { 0 }; +static const char szCompilerVersion[] = "1.5.0.0"; #if !defined(C_ASSERT) #define C_ASSERT(expr) extern char (*c_assert(void)) [(expr) ? 1 : -1] @@ -44,7 +45,7 @@ // Convert utf8 to utf16: //
http://stackoverflow.com/a/7154226/4928207
-bool IsEmptyGuid(GUID& g) +bool IsEmptyGuid(const GUID& g) { return !memcmp(&g, &GUID_NULL, sizeof(GUID)); } @@ -87,6 +88,32 @@ return std::string(rawVal); } return ToString(dbNode.FirstChildElement(nodeName)); +} + +DWORD ReadDWordNode(XMLHandle dbNode, const char* nodeName) +{ + std::string value = ReadStringNode(dbNode, nodeName); + int base = 10; + if (value.size() > 2 && value[0] == '0' && value[1] == 'x') + { + base = 16; + value = value.substr(2); + } + return static_cast<DWORD>(strtoul(value.c_str(), NULL, base)); +} + +unsigned char char2byte(char hexChar, bool* success = NULL) +{ + if (hexChar >= '0' && hexChar <= '9') + return hexChar - '0'; + if (hexChar >= 'A' && hexChar <= 'F') + return hexChar - 'A' + 10; + if (hexChar >= 'a' && hexChar <= 'f') + return hexChar - 'a' + 10; + + if (success) + *success = false; + return 0; } // adapted from wine's ntdll\rtlstr.c rev 1.45 @@ -124,27 +151,11 @@ { CHAR ch = *lpszGUID, ch2 = lpszGUID[1]; unsigned char byte; - - /* Read two hex digits as a byte value */ - if (ch >= '0' && ch <= '9') - ch = ch - '0'; - else if (ch >= 'a' && ch <= 'f') - ch = ch - 'a' + 10; - else if (ch >= 'A' && ch <= 'F') - ch = ch - 'A' + 10; - else + bool converted = true; + + byte = char2byte(ch, &converted) << 4 | char2byte(ch2, &converted); + if (!converted) return false; - - if (ch2 >= '0' && ch2 <= '9') - ch2 = ch2 - '0'; - else if (ch2 >= 'a' && ch2 <= 'f') - ch2 = ch2 - 'a' + 10; - else if (ch2 >= 'A' && ch2 <= 'F') - ch2 = ch2 - 'A' + 10; - else - return false; - - byte = ch << 4 | ch2; switch (i) { @@ -194,13 +205,30 @@ return false; } -bool ReadBinaryNode(XMLHandle dbNode, const char* nodeName, GUID& guid) +bool ReadGuidNode(XMLHandle dbNode, const char* nodeName, GUID& guid) { std::string value = ReadStringNode(dbNode, nodeName); if (!StringToGuid(value, guid)) { memset(&guid, 0, sizeof(GUID)); return false; + } + return true; +} + +bool ReadBinaryNode(XMLHandle dbNode, const char* nodeName, std::vector<BYTE>& data) +{ + std::string value = ReadStringNode(dbNode, nodeName); + value.erase(std::remove_if(value.begin(), value.end(), ::isspace), value.end()); + + size_t length = value.size() / 2; + if (length * 2 != value.size()) + return false; + + data.resize(length); + for (size_t n = 0; n < length; ++n) + { + data[n] = (BYTE)(char2byte(value[n * 2]) << 4 | char2byte(value[(n * 2) + 1])); } return true; } @@ -234,7 +262,7 @@ bool InExclude::toSdb(PDB pdb, Database& db) { TAGID tagid = db.BeginWriteListTag(pdb, TAG_INEXCLUD); - db.WriteString(pdb, TAG_MODULE, Module); + db.WriteString(pdb, TAG_MODULE, Module, true); if (Include) SdbWriteNULLTag(pdb, TAG_INCLUDE); return !!db.EndWriteListTag(pdb, tagid); @@ -282,9 +310,8 @@ bool ShimRef::toSdb(PDB pdb, Database& db) { TAGID tagid = db.BeginWriteListTag(pdb, TAG_SHIM_REF); - db.WriteString(pdb, TAG_NAME, Name); - if (!CommandLine.empty()) - db.WriteString(pdb, TAG_COMMAND_LINE, CommandLine); + db.WriteString(pdb, TAG_NAME, Name, true); + db.WriteString(pdb, TAG_COMMAND_LINE, CommandLine); if (!ShimTagid) ShimTagid = db.FindShimTagid(Name); @@ -301,7 +328,7 @@ { Name = ReadStringNode(dbNode, "NAME"); DllFile = ReadStringNode(dbNode, "DLLFILE"); - ReadBinaryNode(dbNode, "FIX_ID", FixID); + ReadGuidNode(dbNode, "FIX_ID", FixID); // GENERAL ? // DESCRIPTION_RC_ID ReadGeneric(dbNode, InExcludes, "INEXCLUDE"); @@ -337,7 +364,7 @@ bool Layer::toSdb(PDB pdb, Database& db) { Tagid = db.BeginWriteListTag(pdb, TAG_LAYER); - db.WriteString(pdb, TAG_NAME, Name); + db.WriteString(pdb, TAG_NAME, Name, true); if (!WriteGeneric(pdb, ShimRefs, db)) return false; return !!db.EndWriteListTag(pdb, Tagid); @@ -351,9 +378,13 @@ bool MatchingFile::fromXml(XMLHandle dbNode) { Name = ReadStringNode(dbNode, "NAME"); + Size = ReadDWordNode(dbNode, "SIZE"); + Checksum = ReadDWordNode(dbNode, "CHECKSUM"); CompanyName = ReadStringNode(dbNode, "COMPANY_NAME"); + InternalName = ReadStringNode(dbNode, "INTERNAL_NAME"); ProductName = ReadStringNode(dbNode, "PRODUCT_NAME"); ProductVersion = ReadStringNode(dbNode, "PRODUCT_VERSION"); + FileVersion = ReadStringNode(dbNode, "FILE_VERSION"); BinFileVersion = ReadStringNode(dbNode, "BIN_FILE_VERSION"); LinkDate = ReadStringNode(dbNode, "LINK_DATE"); VerLanguage = ReadStringNode(dbNode, "VER_LANGUAGE"); @@ -367,7 +398,28 @@ bool MatchingFile::toSdb(PDB pdb, Database& db) { TAGID tagid = db.BeginWriteListTag(pdb, TAG_MATCHING_FILE); - SHIM_ERR("Unimplemented\n"); + + db.WriteString(pdb, TAG_NAME, Name, true); + db.WriteDWord(pdb, TAG_SIZE, Size); + db.WriteDWord(pdb, TAG_CHECKSUM, Checksum); + db.WriteString(pdb, TAG_COMPANY_NAME, CompanyName); + db.WriteString(pdb, TAG_INTERNAL_NAME, InternalName); + db.WriteString(pdb, TAG_PRODUCT_NAME, ProductName); + db.WriteString(pdb, TAG_PRODUCT_VERSION, ProductVersion); + db.WriteString(pdb, TAG_FILE_VERSION, FileVersion); + if (!BinFileVersion.empty()) + SHIM_ERR("TAG_BIN_FILE_VERSION Unimplemented\n"); //db.WriteQWord(pdb, TAG_BIN_FILE_VERSION, BinFileVersion); + if (!LinkDate.empty()) + SHIM_ERR("TAG_LINK_DATE Unimplemented\n"); //db.WriteDWord(pdb, TAG_LINK_DATE, LinkDate); + if (!VerLanguage.empty()) + SHIM_ERR("TAG_VER_LANGUAGE Unimplemented\n"); //db.WriteDWord(pdb, TAG_VER_LANGUAGE, VerLanguage); + db.WriteString(pdb, TAG_FILE_DESCRIPTION, FileDescription); + db.WriteString(pdb, TAG_ORIGINAL_FILENAME, OriginalFilename); + if (!UptoBinFileVersion.empty()) + SHIM_ERR("TAG_UPTO_BIN_FILE_VERSION Unimplemented\n"); //db.WriteQWord(pdb, TAG_UPTO_BIN_FILE_VERSION, UptoBinFileVersion); + if (!LinkerVersion.empty()) + SHIM_ERR("TAG_LINKER_VERSION Unimplemented\n"); //db.WriteDWord(pdb, TAG_LINKER_VERSION, LinkerVersion); + return !!db.EndWriteListTag(pdb, tagid); } @@ -380,9 +432,12 @@ bool Exe::fromXml(XMLHandle dbNode) { Name = ReadStringNode(dbNode, "NAME"); + ReadGuidNode(dbNode, "EXE_ID", ExeID); AppName = ReadStringNode(dbNode, "APP_NAME"); Vendor = ReadStringNode(dbNode, "VENDOR"); + ReadGeneric(dbNode, MatchingFiles, "MATCHING_FILE"); + ReadGeneric(dbNode, ShimRefs, "SHIM_REF"); return !Name.empty(); @@ -391,7 +446,20 @@ bool Exe::toSdb(PDB pdb, Database& db) { Tagid = db.BeginWriteListTag(pdb, TAG_EXE); - SHIM_ERR("Unimplemented\n"); + + db.WriteString(pdb, TAG_NAME, Name, true); + if (IsEmptyGuid(ExeID)) + RandomGuid(ExeID); + db.WriteBinary(pdb, TAG_EXE_ID, ExeID); + + + db.WriteString(pdb, TAG_APP_NAME, AppName); + db.WriteString(pdb, TAG_VENDOR, Vendor); + + if (!WriteGeneric(pdb, MatchingFiles, db)) + return false; + if (!WriteGeneric(pdb, ShimRefs, db)) + return false; return !!db.EndWriteListTag(pdb, Tagid); } @@ -401,19 +469,33 @@ * Database */ -void Database::WriteBinary(PDB pdb, TAG tag, const GUID& guid) -{ - SdbWriteBinaryTag(pdb, tag, (BYTE*)&guid, sizeof(GUID)); -} - -void Database::WriteString(PDB pdb, TAG tag, const sdbstring& str) -{ - SdbWriteStringTag(pdb, tag, (LPCWSTR)str.c_str()); -} - -void Database::WriteString(PDB pdb, TAG tag, const std::string& str) -{ - WriteString(pdb, tag, sdbstring(str.begin(), str.end())); +void Database::WriteBinary(PDB pdb, TAG tag, const GUID& guid, bool always) +{ + if (always || !IsEmptyGuid(guid)) + SdbWriteBinaryTag(pdb, tag, (BYTE*)&guid, sizeof(GUID)); +} + +void Database::WriteBinary(PDB pdb, TAG tag, const std::vector<BYTE>& data, bool always) +{ + if (always || !data.empty()) + SdbWriteBinaryTag(pdb, tag, data.data(), data.size()); +} + +void Database::WriteString(PDB pdb, TAG tag, const sdbstring& str, bool always) +{ + if (always || !str.empty()) + SdbWriteStringTag(pdb, tag, (LPCWSTR)str.c_str()); +} + +void Database::WriteString(PDB pdb, TAG tag, const std::string& str, bool always) +{ + WriteString(pdb, tag, sdbstring(str.begin(), str.end()), always); +} + +void Database::WriteDWord(PDB pdb, TAG tag, DWORD value, bool always) +{ + if (always || value) + SdbWriteDWORDTag(pdb, tag, value); } TAGID Database::BeginWriteListTag(PDB db, TAG tag) @@ -429,7 +511,7 @@ bool Database::fromXml(XMLHandle dbNode) { Name = ReadStringNode(dbNode, "NAME"); - ReadBinaryNode(dbNode, "DATABASE_ID", ID); + ReadGuidNode(dbNode, "DATABASE_ID", ID); XMLHandle libChild = dbNode.FirstChildElement("LIBRARY").FirstChild(); while (libChild.ToNode()) @@ -439,7 +521,7 @@ { Shim shim; if (shim.fromXml(libChild)) - Library.push_back(shim); + Library.Shims.push_back(shim); } else if (NodeName == "FLAG") { @@ -468,12 +550,17 @@ LARGE_INTEGER li = { 0 }; RtlSecondsSince1970ToTime(time(0), &li); SdbWriteQWORDTag(pdb, TAG_TIME, li.QuadPart); - WriteString(pdb, TAG_COMPILER_VERSION, "1.0.0.0"); + WriteString(pdb, TAG_COMPILER_VERSION, szCompilerVersion); SdbWriteDWORDTag(pdb, TAG_OS_PLATFORM, 1); - WriteString(pdb, TAG_NAME, Name); + WriteString(pdb, TAG_NAME, Name, true); + if (IsEmptyGuid(ID)) + { + SHIM_WARN("DB has empty ID!\n"); + RandomGuid(ID); + } WriteBinary(pdb, TAG_DATABASE_ID, ID); TAGID tidLibrary = BeginWriteListTag(pdb, TAG_LIBRARY); - if (!WriteGeneric(pdb, Library, *this)) + if (!WriteGeneric(pdb, Library.Shims, *this)) return false; EndWriteListTag(pdb, tidLibrary); if (!WriteGeneric(pdb, Layers, *this)) @@ -486,39 +573,49 @@ return true; } - -void Database::InsertShimTagid(const sdbstring& name, TAGID tagid) +static void InsertTagid(const sdbstring& name, TAGID tagid, std::map<sdbstring, TAGID>& lookup, const char* type) { sdbstring nameLower = name; std::transform(nameLower.begin(), nameLower.end(), nameLower.begin(), ::tolower); - if (KnownShims.find(nameLower) != KnownShims.end()) + if (lookup.find(nameLower) != lookup.end()) { std::string nameA(name.begin(), name.end()); - SHIM_WARN("Shim '%s' redefined\n", nameA.c_str()); + SHIM_WARN("%s '%s' redefined\n", type, nameA.c_str()); return; } - KnownShims[nameLower] = tagid; -} - -void Database::InsertShimTagid(const std::string& name, TAGID tagid) -{ - InsertShimTagid(sdbstring(name.begin(), name.end()), tagid); -} - -TAGID Database::FindShimTagid(const sdbstring& name) + lookup[nameLower] = tagid; +} + +static TAGID FindTagid(const sdbstring& name, const std::map<sdbstring, TAGID>& lookup) { sdbstring nameLower = name; std::transform(nameLower.begin(), nameLower.end(), nameLower.begin(), ::tolower); - std::map<sdbstring, TAGID>::iterator it = KnownShims.find(nameLower); - if (it == KnownShims.end()) + std::map<sdbstring, TAGID>::const_iterator it = lookup.find(nameLower); + if (it == lookup.end()) return 0; return it->second; } -TAGID Database::FindShimTagid(const std::string& name) -{ - return FindShimTagid(sdbstring(name.begin(), name.end())); -} +void Database::InsertShimTagid(const sdbstring& name, TAGID tagid) +{ + InsertTagid(name, tagid, KnownShims, "Shim"); +} + +TAGID Database::FindShimTagid(const sdbstring& name) +{ + return FindTagid(name, KnownShims); +} + +void Database::InsertPatchTagid(const sdbstring& name, TAGID tagid) +{ + InsertTagid(name, tagid, KnownPatches, "Patch"); +} + +TAGID Database::FindPatchTagid(const sdbstring& name) +{ + return FindTagid(name, KnownPatches); +} + bool xml_2_db(const char* xml, const WCHAR* sdb) Modified: trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/xml2sdb/xml2sdb.…
============================================================================== --- trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h [iso-8859-1] Mon Jun 26 12:45:01 2017 @@ -71,13 +71,19 @@ struct MatchingFile { + MatchingFile() : Size(0), Checksum(0) {;} + bool fromXml(XMLHandle dbNode); bool toSdb(PDB pdb, Database& db); std::string Name; + DWORD Size; + DWORD Checksum; std::string CompanyName; + std::string InternalName; std::string ProductName; std::string ProductVersion; + std::string FileVersion; std::string BinFileVersion; std::string LinkDate; std::string VerLanguage; @@ -95,10 +101,17 @@ bool toSdb(PDB pdb, Database& db); std::string Name; + GUID ExeID; std::string AppName; std::string Vendor; TAGID Tagid; + std::list<MatchingFile> MatchingFiles; std::list<ShimRef> ShimRefs; +}; + +struct Library +{ + std::list<Shim> Shims; }; struct Database @@ -108,25 +121,34 @@ bool fromXml(XMLHandle dbNode); bool toSdb(LPCWSTR path); - void WriteString(PDB pdb, TAG tag, const sdbstring& str); - void WriteString(PDB pdb, TAG tag, const std::string& str); - void WriteBinary(PDB pdb, TAG tag, const GUID& guid); + void WriteString(PDB pdb, TAG tag, const sdbstring& str, bool always = false); + void WriteString(PDB pdb, TAG tag, const std::string& str, bool always = false); + void WriteBinary(PDB pdb, TAG tag, const GUID& guid, bool always = false); + void WriteBinary(PDB pdb, TAG tag, const std::vector<BYTE>& data, bool always = false); + void WriteDWord(PDB pdb, TAG tag, DWORD value, bool always = false); TAGID BeginWriteListTag(PDB db, TAG tag); BOOL EndWriteListTag(PDB db, TAGID tagid); void InsertShimTagid(const sdbstring& name, TAGID tagid); - void InsertShimTagid(const std::string& name, TAGID tagid); + inline void InsertShimTagid(const std::string& name, TAGID tagid) + { + InsertShimTagid(sdbstring(name.begin(), name.end()), tagid); + } TAGID FindShimTagid(const sdbstring& name); - TAGID FindShimTagid(const std::string& name); + inline TAGID FindShimTagid(const std::string& name) + { + return FindShimTagid(sdbstring(name.begin(), name.end())); + } std::string Name; GUID ID; - std::list<Shim> Library; + struct Library Library; std::list<Layer> Layers; std::list<Exe> Exes; private: std::map<sdbstring, TAGID> KnownShims; + std::map<sdbstring, TAGID> KnownPatches; };
7 years, 6 months
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
...
53
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
Results per page:
10
25
50
100
200