ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
November 2005
----- 2025 -----
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
27 participants
875 discussions
Start a n
N
ew thread
[hpoussin] 19522: Set Tag value in registry when needed.
by hpoussin@svn.reactos.com
Set Tag value in registry when needed. (Not tested due to bug 1048) Modified: trunk/reactos/subsys/system/services/rpcserver.c _____ Modified: trunk/reactos/subsys/system/services/rpcserver.c --- trunk/reactos/subsys/system/services/rpcserver.c 2005-11-24 09:33:29 UTC (rev 19521) +++ trunk/reactos/subsys/system/services/rpcserver.c 2005-11-24 11:03:23 UTC (rev 19522) @@ -219,6 +219,17 @@ } +DWORD +ScmAssignNewTag(LPWSTR lpServiceGroup, + LPDWORD lpdwTagId) +{ + /* FIXME */ + DPRINT("Assigning new tag in group %S\n", lpServiceGroup); + *lpdwTagId = 0; + return ERROR_SUCCESS; +} + + /* Function 0 */ unsigned long ScmrCloseServiceHandle(handle_t BindingHandle, @@ -599,7 +610,7 @@ /* Open the service key */ dwError = ScmOpenServiceKey(lpService->szServiceName, - KEY_WRITE, + KEY_SET_VALUE, &hServiceKey); if (dwError != ERROR_SUCCESS) goto done; @@ -614,6 +625,7 @@ REG_SZ, (LPBYTE)lpDisplayName, (wcslen(lpDisplayName) + 1) * sizeof(WCHAR)); + /* FIXME: update lpService->lpDisplayName */ } if (dwServiceType != SERVICE_NO_CHANGE) @@ -627,6 +639,7 @@ sizeof(DWORD)); if (dwError != ERROR_SUCCESS) goto done; + /* FIXME: lpService->dwType = dwServiceType; */ } if (dwStartType != SERVICE_NO_CHANGE) @@ -640,6 +653,7 @@ sizeof(DWORD)); if (dwError != ERROR_SUCCESS) goto done; + lpService->dwStartType = dwStartType; } if (dwErrorControl != SERVICE_NO_CHANGE) @@ -653,6 +667,7 @@ sizeof(DWORD)); if (dwError != ERROR_SUCCESS) goto done; + lpService->dwErrorControl = dwErrorControl; } #if 0 @@ -700,11 +715,24 @@ (wcslen(lpLoadOrderGroup) + 1) * sizeof(WCHAR)); if (dwError != ERROR_SUCCESS) goto done; + /* FIXME: update lpService->lpServiceGroup */ } if (lpdwTagId != NULL) { - /* FIXME: Write tag */ + dwError = ScmAssignNewTag(lpService->lpServiceGroup, + &lpService->dwTag); + if (dwError != ERROR_SUCCESS) + goto done; + dwError = RegSetValueExW(hServiceKey, + L"Tag", + 0, + REG_DWORD, + (LPBYTE)&lpService->dwTag, + sizeof(DWORD)); + if (dwError != ERROR_SUCCESS) + goto done; + *lpdwTagId = lpService->dwTag; } /* Write dependencies */ @@ -926,7 +954,18 @@ if (lpdwTagId != NULL) { - /* FIXME: Write tag */ + dwError = ScmAssignNewTag(lpService->lpServiceGroup, + &lpService->dwTag); + if (dwError != ERROR_SUCCESS) + goto done; + dwError = RegSetValueExW(hServiceKey, + L"Tag", + 0, + REG_DWORD, + (LPBYTE)&lpService->dwTag, + sizeof(DWORD)); + if (dwError != ERROR_SUCCESS) + goto done; } /* Write dependencies */ @@ -964,7 +1003,7 @@ *hService = (unsigned int)hServiceHandle; if (lpdwTagId != NULL) - *lpdwTagId = 0; /* FIXME */ + *lpdwTagId = lpService->dwTag; } else {
19 years, 1 month
1
0
0
0
[hpoussin] 19521: Fix Start value for mouclass driver, which was leading to not detect legacy mouse drivers as i8042prt
by hpoussin@svn.reactos.com
Fix Start value for mouclass driver, which was leading to not detect legacy mouse drivers as i8042prt Modified: trunk/reactos/media/inf/mouse.inf _____ Modified: trunk/reactos/media/inf/mouse.inf --- trunk/reactos/media/inf/mouse.inf 2005-11-24 09:18:16 UTC (rev 19520) +++ trunk/reactos/media/inf/mouse.inf 2005-11-24 09:33:29 UTC (rev 19521) @@ -53,7 +53,7 @@ [mouclass_Service_Inst] ServiceType = 1 -StartType = 3 +StartType = 1 ErrorControl = 1 ServiceBinary = %12%\mouclass.sys LoadOrderGroup = Pointer Class
19 years, 1 month
1
0
0
0
[hpoussin] 19520: Detect devices using the NULL driver, and set the STARTED flag
by hpoussin@svn.reactos.com
Detect devices using the NULL driver, and set the STARTED flag Modified: trunk/reactos/ntoskrnl/io/pnpmgr.c _____ Modified: trunk/reactos/ntoskrnl/io/pnpmgr.c --- trunk/reactos/ntoskrnl/io/pnpmgr.c 2005-11-24 09:11:44 UTC (rev 19519) +++ trunk/reactos/ntoskrnl/io/pnpmgr.c 2005-11-24 09:18:16 UTC (rev 19520) @@ -1922,9 +1922,11 @@ PDEVICE_NODE DeviceNode, PVOID Context) { - RTL_QUERY_REGISTRY_TABLE QueryTable[2]; + RTL_QUERY_REGISTRY_TABLE QueryTable[3]; PDEVICE_NODE ParentDeviceNode; PUNICODE_STRING Service; + UNICODE_STRING ClassGUID; + UNICODE_STRING NullString = RTL_CONSTANT_STRING(L""); NTSTATUS Status; DPRINT("IopActionConfigureChildServices(%p, %p)\n", DeviceNode, Context); @@ -1969,11 +1971,19 @@ RtlZeroMemory(QueryTable, sizeof(QueryTable)); RtlInitUnicodeString(Service, NULL); + RtlInitUnicodeString(&ClassGUID, NULL); QueryTable[0].Name = L"Service"; QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT; QueryTable[0].EntryContext = Service; + QueryTable[1].Name = L"ClassGUID"; + QueryTable[1].Flags = RTL_QUERY_REGISTRY_DIRECT; + QueryTable[1].EntryContext = &ClassGUID; + QueryTable[1].DefaultType = REG_SZ; + QueryTable[1].DefaultData = &NullString; + QueryTable[1].DefaultLength = 0; + RtlAppendUnicodeToString(&RegKey, L"\\Registry\\Machine\\System\\CurrentControlSet\\Enum\\"); RtlAppendUnicodeStringToString(&RegKey, &DeviceNode->InstancePath); @@ -1993,6 +2003,15 @@ if (Service->Buffer == NULL) { IopDeviceNodeSetFlag(DeviceNode, DNF_DISABLED); + + if (ClassGUID.Length != 0) + { + /* Device has a ClassGUID value, but no Service value. + * Suppose it is using the NULL driver, so state the + * device is started */ + DPRINT("%wZ is using NULL driver\n", &DeviceNode->InstancePath); + IopDeviceNodeSetFlag(DeviceNode, DNF_STARTED); + } return STATUS_SUCCESS; }
19 years, 1 month
1
0
0
0
[hpoussin] 19519: Fix access rights when opening registry keys
by hpoussin@svn.reactos.com
Fix access rights when opening registry keys Better traces Modified: trunk/reactos/lib/setupapi/devinst.c _____ Modified: trunk/reactos/lib/setupapi/devinst.c --- trunk/reactos/lib/setupapi/devinst.c 2005-11-24 09:05:38 UTC (rev 19518) +++ trunk/reactos/lib/setupapi/devinst.c 2005-11-24 09:11:44 UTC (rev 19519) @@ -149,13 +149,14 @@ LONG lError; DWORD dwGuidListIndex = 0; - TRACE("\n"); + TRACE("0x%lx %p %lu %p %s %p\n", Flags, ClassGuidList, + ClassGuidListSize, RequiredSize, debugstr_w(MachineName), Reserved); if (RequiredSize != NULL) *RequiredSize = 0; hClassesKey = SetupDiOpenClassRegKeyExW(NULL, - KEY_ALL_ACCESS, + KEY_ENUMERATE_SUB_KEYS, DIOCR_INSTALLER, MachineName, Reserved); @@ -178,12 +179,12 @@ TRACE("RegEnumKeyExW() returns %ld\n", lError); if (lError == ERROR_SUCCESS || lError == ERROR_MORE_DATA) { - TRACE("Key name: %p\n", szKeyName); + TRACE("Key name: %s\n", debugstr_w(szKeyName)); if (RegOpenKeyExW(hClassesKey, szKeyName, 0, - KEY_ALL_ACCESS, + KEY_QUERY_VALUE, &hClassKey)) { RegCloseKey(hClassesKey); @@ -230,14 +231,14 @@ RegCloseKey(hClassKey); - TRACE("Guid: %p\n", szKeyName); + TRACE("Guid: %s\n", debugstr_w(szKeyName)); if (dwGuidListIndex < ClassGuidListSize) { if (szKeyName[0] == L'{' && szKeyName[37] == L'}') { szKeyName[37] = 0; } - TRACE("Guid: %p\n", &szKeyName[1]); + TRACE("Guid: %s\n", debugstr_w(&szKeyName[1])); UuidFromStringW(&szKeyName[1], &ClassGuidList[dwGuidListIndex]); @@ -355,6 +356,9 @@ LONG lError; DWORD dwGuidListIndex = 0; + TRACE("%s %p %lu %p %s %p\n", debugstr_w(ClassName), ClassGuidList, + ClassGuidListSize, RequiredSize, debugstr_w(MachineName), Reserved); + if (RequiredSize != NULL) *RequiredSize = 0; @@ -382,7 +386,7 @@ TRACE("RegEnumKeyExW() returns %ld\n", lError); if (lError == ERROR_SUCCESS || lError == ERROR_MORE_DATA) { - TRACE("Key name: %p\n", szKeyName); + TRACE("Key name: %s\n", debugstr_w(szKeyName)); if (RegOpenKeyExW(hClassesKey, szKeyName, @@ -402,20 +406,20 @@ (LPBYTE)szClassName, &dwLength)) { - TRACE("Class name: %p\n", szClassName); + TRACE("Class name: %s\n", debugstr_w(szClassName)); if (strcmpiW(szClassName, ClassName) == 0) { TRACE("Found matching class name\n"); - TRACE("Guid: %p\n", szKeyName); + TRACE("Guid: %s\n", debugstr_w(szKeyName)); if (dwGuidListIndex < ClassGuidListSize) { if (szKeyName[0] == L'{' && szKeyName[37] == L'}') { szKeyName[37] = 0; } - TRACE("Guid: %p\n", &szKeyName[1]); + TRACE("Guid: %s\n", debugstr_w(&szKeyName[1])); UuidFromStringW(&szKeyName[1], &ClassGuidList[dwGuidListIndex]); @@ -520,6 +524,9 @@ DWORD dwLength; LONG rc; + TRACE("%s %p %lu %p %s %p\n", debugstr_guid(ClassGuid), ClassName, + ClassNameSize, RequiredSize, debugstr_w(MachineName), Reserved); + hKey = SetupDiOpenClassRegKeyExW(ClassGuid, KEY_QUERY_VALUE, DIOCR_INSTALLER, @@ -590,7 +597,8 @@ LPWSTR MachineNameW = NULL; HDEVINFO hDevInfo; - TRACE("%p %p %s %p\n", ClassGuid, hwndParent, MachineName, Reserved); + TRACE("%s %p %s %p\n", debugstr_guid(ClassGuid), hwndParent, + debugstr_a(MachineName), Reserved); if (MachineName) { @@ -623,7 +631,8 @@ //CONFIGRET cr; HDEVINFO ret = (HDEVINFO)INVALID_HANDLE_VALUE;; - TRACE("%p %p %S %p\n", ClassGuid, hwndParent, MachineName, Reserved); + TRACE("%s %p %s %p\n", debugstr_guid(ClassGuid), hwndParent, + debugstr_w(MachineName), Reserved); list = HeapAlloc(GetProcessHeap(), 0, sizeof(struct DeviceInfoSet)); if (!list) @@ -817,6 +826,9 @@ DWORD dwFullLength; LONG lLineCount = -1; + TRACE("%p %s %p %lu %p %p\n", InfHandle, debugstr_w(InfSectionName), + InfSectionWithExt, InfSectionWithExtSize, RequiredSize, Extension); + lstrcpyW(szBuffer, InfSectionName); dwLength = lstrlenW(szBuffer); @@ -977,8 +989,11 @@ HKEY hKey; DWORD dwLength; + TRACE("%s %p %lu %p %s %p\n", debugstr_guid(ClassGuid), ClassDescription, + ClassDescriptionSize, RequiredSize, debugstr_w(MachineName), Reserved); + hKey = SetupDiOpenClassRegKeyExW(ClassGuid, - KEY_ALL_ACCESS, + KEY_QUERY_VALUE, DIOCR_INSTALLER, MachineName, Reserved); @@ -1967,7 +1982,7 @@ DWORD sizeW = 0, sizeA; BOOL ret = FALSE; - TRACE("(%p, %p, %p, %ld, %p, %p)\n", DeviceInfoSet, + TRACE("%p %p %p %lu %p %p\n", DeviceInfoSet, DeviceInterfaceData, DeviceInterfaceDetailData, DeviceInterfaceDetailDataSize, RequiredSize, DeviceInfoData); @@ -2036,7 +2051,7 @@ struct DeviceInfoSet *list; BOOL ret = FALSE; - TRACE("(%p, %p, %p, %ld, %p, %p): stub\n", DeviceInfoSet, + TRACE("%p %p %p %lu %p %p\n", DeviceInfoSet, DeviceInterfaceData, DeviceInterfaceDetailData, DeviceInterfaceDetailDataSize, RequiredSize, DeviceInfoData); @@ -2579,7 +2594,7 @@ 0, NULL, REG_OPTION_NON_VOLATILE, - KEY_ALL_ACCESS, + KEY_SET_VALUE, NULL, &hClassKey, NULL)) @@ -2618,6 +2633,9 @@ BOOL bFileQueueCreated = FALSE; HKEY hClassKey; + TRACE("%p %s 0x%lx %p\n", hwndParent, debugstr_w(InfFileName), + Flags, FileQueue); + FIXME("not fully implemented\n"); if ((Flags & DI_NOVCP) && (FileQueue == NULL || FileQueue == INVALID_HANDLE_VALUE)) @@ -2763,6 +2781,9 @@ DWORD rc; LPCWSTR lpKeyName; + TRACE("%s 0x%lx 0x%lx %s %p\n", debugstr_guid(ClassGuid), samDesired, + Flags, debugstr_w(MachineName), Reserved); + if (Flags == DIOCR_INSTALLER) { lpKeyName = ControlClass; @@ -2793,7 +2814,7 @@ rc = RegOpenKeyExW(HKLM, lpKeyName, 0, - KEY_ALL_ACCESS, + ClassGuid ? KEY_ENUMERATE_SUB_KEYS : samDesired, &hClassesKey); if (MachineName != NULL) RegCloseKey(HKLM); if (rc != ERROR_SUCCESS) @@ -2829,7 +2850,7 @@ rc = RegOpenKeyExW(hClassesKey, lpFullGuidString, 0, - KEY_ALL_ACCESS, + samDesired, &hClassKey); if (rc != ERROR_SUCCESS) {
19 years, 1 month
1
0
0
0
[hpoussin] 19518: Third parameter in INF AddService directive seems to be optional. Ignore the error if it is missing
by hpoussin@svn.reactos.com
Third parameter in INF AddService directive seems to be optional. Ignore the error if it is missing Implement SetupDiGetDeviceInfoListDetailW Modified: trunk/reactos/lib/setupapi/devinst.c Modified: trunk/reactos/lib/setupapi/parser.c Modified: trunk/reactos/lib/setupapi/stubs.c _____ Modified: trunk/reactos/lib/setupapi/devinst.c --- trunk/reactos/lib/setupapi/devinst.c 2005-11-24 08:12:20 UTC (rev 19517) +++ trunk/reactos/lib/setupapi/devinst.c 2005-11-24 09:05:38 UTC (rev 19518) @@ -3284,6 +3284,42 @@ } /*********************************************************************** + * SetupDiGetDeviceInfoListDetailW (SETUPAPI.@) + */ +BOOL WINAPI SetupDiGetDeviceInfoListDetailW( + IN HDEVINFO DeviceInfoSet, + OUT PSP_DEVINFO_LIST_DETAIL_DATA_W DeviceInfoListDetailData) +{ + struct DeviceInfoSet *list; + BOOL ret = FALSE; + + TRACE("%p %p\n", DeviceInfoSet, DeviceInfoListDetailData); + + if (!DeviceInfoSet) + SetLastError(ERROR_INVALID_HANDLE); + else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC) + SetLastError(ERROR_INVALID_HANDLE); + else if (!DeviceInfoListDetailData) + SetLastError(ERROR_INVALID_PARAMETER); + else if (DeviceInfoListDetailData->cbSize != sizeof(SP_DEVINFO_LIST_DETAIL_DATA_W)) + SetLastError(ERROR_INVALID_USER_BUFFER); + else + { + memcpy( + &DeviceInfoListDetailData->ClassGuid, + &list->ClassGuid, + sizeof(GUID)); + DeviceInfoListDetailData->RemoteMachineHandle = list->hMachine; + DeviceInfoListDetailData->RemoteMachineName[0] = 0; /* FIXME */ + + ret = TRUE; + } + + TRACE("Returning %d\n", ret); + return ret; +} + +/********************************************************************** * * SetupDiGetDeviceInstallParamsA (SETUPAPI.@) */ BOOL WINAPI SetupDiGetDeviceInstallParamsA( @@ -5915,7 +5951,17 @@ NULL, 0, &RequiredSize); if (!Result) - goto nextfile; + { + if (GetLastError() == ERROR_INVALID_PARAMETER) + { + /* This first is probably missing. It is not + * required, so ignore the error */ + RequiredSize = 0; + Result = TRUE; + } + else + goto nextfile; + } if (RequiredSize > 0) { /* We got the needed size for the buffer */ @@ -5932,11 +5978,12 @@ &RequiredSize); if (!Result) goto nextfile; + + SetLastError(ERROR_SUCCESS); + Result = SetupInstallServicesFromInfSectionExW( + SelectedDriver->InfFileDetails->hInf, + ServiceSection, Flags, DeviceInfoSet, DeviceInfoData, ServiceName, NULL); } - SetLastError(ERROR_SUCCESS); - Result = SetupInstallServicesFromInfSectionExW( - SelectedDriver->InfFileDetails->hInf, - ServiceSection, Flags, DeviceInfoSet, DeviceInfoData, ServiceName, NULL); if (Result && (Flags & SPSVCINST_ASSOCSERVICE)) { AssociatedService = ServiceName; @@ -5989,20 +6036,20 @@ /* Write information to enum key */ TRACE("Write information to enum key\n"); - TRACE("Service : '%S'\n", AssociatedService); TRACE("Class : '%S'\n", ClassName); TRACE("ClassGUID : '%S'\n", lpFullGuidString); TRACE("DeviceDesc : '%S'\n", SelectedDriver->Info.Description); TRACE("Mfg : '%S'\n", SelectedDriver->Info.MfgName); - rc = RegSetValueEx(hKey, L"Service", 0, REG_SZ, (const BYTE *)AssociatedService, (wcslen(AssociatedService) + 1) * sizeof(WCHAR)); + TRACE("Service : '%S'\n", AssociatedService); + rc = RegSetValueEx(hKey, L"Class", 0, REG_SZ, (const BYTE *)ClassName, (wcslen(ClassName) + 1) * sizeof(WCHAR)); if (rc == ERROR_SUCCESS) - rc = RegSetValueEx(hKey, L"Class", 0, REG_SZ, (const BYTE *)ClassName, (wcslen(ClassName) + 1) * sizeof(WCHAR)); - if (rc == ERROR_SUCCESS) rc = RegSetValueEx(hKey, L"ClassGUID", 0, REG_SZ, (const BYTE *)lpFullGuidString, (wcslen(lpFullGuidString) + 1) * sizeof(WCHAR)); if (rc == ERROR_SUCCESS) rc = RegSetValueEx(hKey, L"DeviceDesc", 0, REG_SZ, (const BYTE *)SelectedDriver->Info.Description, (wcslen(SelectedDriver->Info.Description) + 1) * sizeof(WCHAR)); if (rc == ERROR_SUCCESS) rc = RegSetValueEx(hKey, L"Mfg", 0, REG_SZ, (const BYTE *)SelectedDriver->Info.MfgName, (wcslen(SelectedDriver->Info.MfgName) + 1) * sizeof(WCHAR)); + if (rc == ERROR_SUCCESS && *AssociatedService) + rc = RegSetValueEx(hKey, L"Service", 0, REG_SZ, (const BYTE *)AssociatedService, (wcslen(AssociatedService) + 1) * sizeof(WCHAR)); if (rc != ERROR_SUCCESS) { SetLastError(rc); _____ Modified: trunk/reactos/lib/setupapi/parser.c --- trunk/reactos/lib/setupapi/parser.c 2005-11-24 08:12:20 UTC (rev 19517) +++ trunk/reactos/lib/setupapi/parser.c 2005-11-24 09:05:38 UTC (rev 19518) @@ -1691,7 +1691,7 @@ unsigned int len; SetLastError(0); - if (!field) return FALSE; + if (!field) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } len = PARSER_string_substA( file, field->text, NULL, 0 ); if (required) *required = len + 1; if (buffer) @@ -1722,7 +1722,7 @@ unsigned int len; SetLastError(0); - if (!field) return FALSE; + if (!field) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } len = PARSER_string_substW( file, field->text, NULL, 0 ); if (required) *required = len + 1; if (buffer) _____ Modified: trunk/reactos/lib/setupapi/stubs.c --- trunk/reactos/lib/setupapi/stubs.c 2005-11-24 08:12:20 UTC (rev 19517) +++ trunk/reactos/lib/setupapi/stubs.c 2005-11-24 09:05:38 UTC (rev 19518) @@ -51,15 +51,6 @@ } /*********************************************************************** - * SetupDiGetDeviceInfoListDetailW (SETUPAPI.@) - */ -BOOL WINAPI SetupDiGetDeviceInfoListDetailW(HDEVINFO devinfo, PSP_DEVINFO_LIST_DETAIL_DATA_W devinfo_data ) -{ - FIXME("\n"); - return FALSE; -} - -/********************************************************************** * * SetupCopyOEMInfA (SETUPAPI.@) */ BOOL WINAPI SetupCopyOEMInfA(PCSTR sourceinffile, PCSTR sourcemedialoc,
19 years, 1 month
1
0
0
0
[gvg] 19517: Use inflib
by gvg@svn.reactos.com
Use inflib Deleted: trunk/reactos/subsys/system/usetup/infcache.c Deleted: trunk/reactos/subsys/system/usetup/infcache.h Modified: trunk/reactos/subsys/system/usetup/registry.c Modified: trunk/reactos/subsys/system/usetup/settings.c Modified: trunk/reactos/subsys/system/usetup/usetup.c Modified: trunk/reactos/subsys/system/usetup/usetup.h Modified: trunk/reactos/subsys/system/usetup/usetup.xml _____ Deleted: trunk/reactos/subsys/system/usetup/infcache.c --- trunk/reactos/subsys/system/usetup/infcache.c 2005-11-24 08:07:12 UTC (rev 19516) +++ trunk/reactos/subsys/system/usetup/infcache.c 2005-11-24 08:12:20 UTC (rev 19517) @@ -1,1625 +0,0 @@ -/* - * ReactOS kernel - * Copyright (C) 2002,2003 ReactOS Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* $Id$ - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS text-mode setup - * FILE: subsys/system/usetup/infcache.c - * PURPOSE: INF file parser that caches contents of INF file in memory - * PROGRAMMER: Royce Mitchell III - * Eric Kohl - */ - -/* INCLUDES *****************************************************************/ - -#include <usetup.h> - -#define NDEBUG -#include <debug.h> - -#define CONTROL_Z '\x1a' -#define MAX_SECTION_NAME_LEN 255 -#define MAX_FIELD_LEN 511 /* larger fields get silently truncated */ -/* actual string limit is MAX_INF_STRING_LENGTH+1 (plus terminating null) under Windows */ -#define MAX_STRING_LEN (MAX_INF_STRING_LENGTH+1) - - -typedef struct _INFCACHEFIELD -{ - struct _INFCACHEFIELD *Next; - struct _INFCACHEFIELD *Prev; - - WCHAR Data[1]; -} INFCACHEFIELD, *PINFCACHEFIELD; - - -typedef struct _INFCACHELINE -{ - struct _INFCACHELINE *Next; - struct _INFCACHELINE *Prev; - - LONG FieldCount; - - PWCHAR Key; - - PINFCACHEFIELD FirstField; - PINFCACHEFIELD LastField; - -} INFCACHELINE, *PINFCACHELINE; - - -typedef struct _INFCACHESECTION -{ - struct _INFCACHESECTION *Next; - struct _INFCACHESECTION *Prev; - - PINFCACHELINE FirstLine; - PINFCACHELINE LastLine; - - LONG LineCount; - - WCHAR Name[1]; -} INFCACHESECTION, *PINFCACHESECTION; - - -typedef struct _INFCACHE -{ - PINFCACHESECTION FirstSection; - PINFCACHESECTION LastSection; - - PINFCACHESECTION StringsSection; -} INFCACHE, *PINFCACHE; - - -/* parser definitions */ - -enum parser_state -{ - LINE_START, /* at beginning of a line */ - SECTION_NAME, /* parsing a section name */ - KEY_NAME, /* parsing a key name */ - VALUE_NAME, /* parsing a value name */ - EOL_BACKSLASH, /* backslash at end of line */ - QUOTES, /* inside quotes */ - LEADING_SPACES, /* leading spaces */ - TRAILING_SPACES, /* trailing spaces */ - COMMENT, /* inside a comment */ - NB_PARSER_STATES -}; - -struct parser -{ - const CHAR *start; /* start position of item being parsed */ - const CHAR *end; /* end of buffer */ - PINFCACHE file; /* file being built */ - enum parser_state state; /* current parser state */ - enum parser_state stack[4]; /* state stack */ - int stack_pos; /* current pos in stack */ - - PINFCACHESECTION cur_section; /* pointer to the section being parsed*/ - PINFCACHELINE line; /* current line */ - unsigned int line_pos; /* current line position in file */ - unsigned int error; /* error code */ - unsigned int token_len; /* current token len */ - WCHAR token[MAX_FIELD_LEN+1]; /* current token */ -}; - -typedef const CHAR * (*parser_state_func)( struct parser *parser, const CHAR *pos ); - -/* parser state machine functions */ -static const CHAR *line_start_state( struct parser *parser, const CHAR *pos ); -static const CHAR *section_name_state( struct parser *parser, const CHAR *pos ); -static const CHAR *key_name_state( struct parser *parser, const CHAR *pos ); -static const CHAR *value_name_state( struct parser *parser, const CHAR *pos ); -static const CHAR *eol_backslash_state( struct parser *parser, const CHAR *pos ); -static const CHAR *quotes_state( struct parser *parser, const CHAR *pos ); -static const CHAR *leading_spaces_state( struct parser *parser, const CHAR *pos ); -static const CHAR *trailing_spaces_state( struct parser *parser, const CHAR *pos ); -static const CHAR *comment_state( struct parser *parser, const CHAR *pos ); - -static const parser_state_func parser_funcs[NB_PARSER_STATES] = -{ - line_start_state, /* LINE_START */ - section_name_state, /* SECTION_NAME */ - key_name_state, /* KEY_NAME */ - value_name_state, /* VALUE_NAME */ - eol_backslash_state, /* EOL_BACKSLASH */ - quotes_state, /* QUOTES */ - leading_spaces_state, /* LEADING_SPACES */ - trailing_spaces_state, /* TRAILING_SPACES */ - comment_state /* COMMENT */ -}; - - -/* PRIVATE FUNCTIONS ********************************************************/ - -static PINFCACHELINE -InfpCacheFreeLine (PINFCACHELINE Line) -{ - PINFCACHELINE Next; - PINFCACHEFIELD Field; - - if (Line == NULL) - { - return NULL; - } - - Next = Line->Next; - if (Line->Key != NULL) - { - RtlFreeHeap (ProcessHeap, - 0, - Line->Key); - Line->Key = NULL; - } - - /* Remove data fields */ - while (Line->FirstField != NULL) - { - Field = Line->FirstField->Next; - RtlFreeHeap (ProcessHeap, - 0, - Line->FirstField); - Line->FirstField = Field; - } - Line->LastField = NULL; - - RtlFreeHeap (ProcessHeap, - 0, - Line); - - return Next; -} - - -static PINFCACHESECTION -InfpCacheFreeSection (PINFCACHESECTION Section) -{ - PINFCACHESECTION Next; - - if (Section == NULL) - { - return NULL; - } - - /* Release all keys */ - Next = Section->Next; - while (Section->FirstLine != NULL) - { - Section->FirstLine = InfpCacheFreeLine (Section->FirstLine); - } - Section->LastLine = NULL; - - RtlFreeHeap (ProcessHeap, - 0, - Section); - - return Next; -} - - -static PINFCACHESECTION -InfpCacheFindSection (PINFCACHE Cache, - PWCHAR Name) -{ - PINFCACHESECTION Section = NULL; - - if (Cache == NULL || Name == NULL) - { - return NULL; - } - - /* iterate through list of sections */ - Section = Cache->FirstSection; - while (Section != NULL) - { - if (_wcsicmp (Section->Name, Name) == 0) - { - return Section; - } - - /* get the next section*/ - Section = Section->Next; - } - - return NULL; -} - - -static PINFCACHESECTION -InfpCacheAddSection (PINFCACHE Cache, - PWCHAR Name) -{ - PINFCACHESECTION Section = NULL; - ULONG Size; - - if (Cache == NULL || Name == NULL) - { - DPRINT("Invalid parameter\n"); - return NULL; - } - - /* Allocate and initialize the new section */ - Size = sizeof(INFCACHESECTION) + (wcslen (Name) * sizeof(WCHAR)); - Section = (PINFCACHESECTION)RtlAllocateHeap (ProcessHeap, - 0, - Size); - if (Section == NULL) - { - DPRINT("RtlAllocateHeap() failed\n"); - return NULL; - } - RtlZeroMemory (Section, - Size); - - /* Copy section name */ - wcscpy (Section->Name, Name); - - /* Append section */ - if (Cache->FirstSection == NULL) - { - Cache->FirstSection = Section; - Cache->LastSection = Section; - } - else - { - Cache->LastSection->Next = Section; - Section->Prev = Cache->LastSection; - Cache->LastSection = Section; - } - - return Section; -} - - -static PINFCACHELINE -InfpCacheAddLine (PINFCACHESECTION Section) -{ - PINFCACHELINE Line; - - if (Section == NULL) - { - DPRINT("Invalid parameter\n"); - return NULL; - } - - Line = (PINFCACHELINE)RtlAllocateHeap (ProcessHeap, - 0, - sizeof(INFCACHELINE)); - if (Line == NULL) - { - DPRINT("RtlAllocateHeap() failed\n"); - return NULL; - } - RtlZeroMemory(Line, - sizeof(INFCACHELINE)); - - /* Append line */ - if (Section->FirstLine == NULL) - { - Section->FirstLine = Line; - Section->LastLine = Line; - } - else - { - Section->LastLine->Next = Line; - Line->Prev = Section->LastLine; - Section->LastLine = Line; - } - Section->LineCount++; - - return Line; -} - - -static PVOID -InfpAddKeyToLine (PINFCACHELINE Line, - PWCHAR Key) -{ - if (Line == NULL) - return NULL; - - if (Line->Key != NULL) - return NULL; - - Line->Key = (PWCHAR)RtlAllocateHeap (ProcessHeap, - 0, - (wcslen (Key) + 1) * sizeof(WCHAR)); - if (Line->Key == NULL) - return NULL; - - wcscpy (Line->Key, Key); - - return (PVOID)Line->Key; -} - - -static PVOID -InfpAddFieldToLine (PINFCACHELINE Line, - PWCHAR Data) -{ - PINFCACHEFIELD Field; - ULONG Size; - - Size = sizeof(INFCACHEFIELD) + (wcslen(Data) * sizeof(WCHAR)); - Field = (PINFCACHEFIELD)RtlAllocateHeap (ProcessHeap, - 0, - Size); - if (Field == NULL) - { - return NULL; - } - RtlZeroMemory (Field, - Size); - wcscpy (Field->Data, Data); - - /* Append key */ - if (Line->FirstField == NULL) - { - Line->FirstField = Field; - Line->LastField = Field; - } - else - { - Line->LastField->Next = Field; - Field->Prev = Line->LastField; - Line->LastField = Field; - } - Line->FieldCount++; - - return (PVOID)Field; -} - - -static PINFCACHELINE -InfpCacheFindKeyLine (PINFCACHESECTION Section, - PWCHAR Key) -{ - PINFCACHELINE Line; - - Line = Section->FirstLine; - while (Line != NULL) - { - if (Line->Key != NULL && _wcsicmp (Line->Key, Key) == 0) - { - return Line; - } - - Line = Line->Next; - } - - return NULL; -} - - -/* push the current state on the parser stack */ -inline static void push_state( struct parser *parser, enum parser_state state ) -{ -// assert( parser->stack_pos < sizeof(parser->stack)/sizeof(parser->stack[0]) ); - parser->stack[parser->stack_pos++] = state; -} - - -/* pop the current state */ -inline static void pop_state( struct parser *parser ) -{ -// assert( parser->stack_pos ); - parser->state = parser->stack[--parser->stack_pos]; -} - - -/* set the parser state and return the previous one */ -inline static enum parser_state set_state( struct parser *parser, enum parser_state state ) -{ - enum parser_state ret = parser->state; - parser->state = state; - return ret; -} - - -/* check if the pointer points to an end of file */ -inline static int is_eof( struct parser *parser, const CHAR *ptr ) -{ - return (ptr >= parser->end || *ptr == CONTROL_Z); -} - - -/* check if the pointer points to an end of line */ -inline static int is_eol( struct parser *parser, const CHAR *ptr ) -{ - return (ptr >= parser->end || - *ptr == CONTROL_Z || - *ptr == '\n' || - (*ptr == '\r' && *(ptr + 1) == '\n')); -} - - -/* push data from current token start up to pos into the current token */ -static int push_token( struct parser *parser, const CHAR *pos ) -{ - unsigned int len = pos - parser->start; - const CHAR *src = parser->start; - WCHAR *dst = parser->token + parser->token_len; - - if (len > MAX_FIELD_LEN - parser->token_len) - len = MAX_FIELD_LEN - parser->token_len; - - parser->token_len += len; - for ( ; len > 0; len--, dst++, src++) - *dst = *src ? (WCHAR)*src : L' '; - *dst = 0; - parser->start = pos; - - return 0; -} - - - -/* add a section with the current token as name */ -static PVOID add_section_from_token( struct parser *parser ) -{ - PINFCACHESECTION Section; - - if (parser->token_len > MAX_SECTION_NAME_LEN) - { - parser->error = STATUS_SECTION_NAME_TOO_LONG; - return NULL; - } - - Section = InfpCacheFindSection (parser->file, - parser->token); - if (Section == NULL) - { - /* need to create a new one */ - Section= InfpCacheAddSection (parser->file, - parser->token); - if (Section == NULL) - { - parser->error = STATUS_NOT_ENOUGH_MEMORY; - return NULL; - } - } - - parser->token_len = 0; - parser->cur_section = Section; - - return (PVOID)Section; -} - - -/* add a field containing the current token to the current line */ -static struct field *add_field_from_token( struct parser *parser, int is_key ) -{ - PVOID field; - - if (!parser->line) /* need to start a new line */ - { - if (parser->cur_section == NULL) /* got a line before the first section */ - { - parser->error = STATUS_WRONG_INF_STYLE; - return NULL; - } - - parser->line = InfpCacheAddLine (parser->cur_section); - if (parser->line == NULL) - goto error; - } - else - { -// assert(!is_key); - } - - if (is_key) - { - field = InfpAddKeyToLine(parser->line, parser->token); - } - else - { - field = InfpAddFieldToLine(parser->line, parser->token); - } - - if (field != NULL) - { - parser->token_len = 0; - return field; - } - -error: - parser->error = STATUS_NOT_ENOUGH_MEMORY; - return NULL; -} - - -/* close the current line and prepare for parsing a new one */ -static void close_current_line( struct parser *parser ) -{ - parser->line = NULL; -} - - - -/* handler for parser LINE_START state */ -static const CHAR *line_start_state( struct parser *parser, const CHAR *pos ) -{ - const CHAR *p; - - for (p = pos; !is_eof( parser, p ); p++) - { - switch(*p) - { - case '\r': - continue; - - case '\n': - parser->line_pos++; - close_current_line( parser ); - break; - - case ';': - push_state( parser, LINE_START ); - set_state( parser, COMMENT ); - return p + 1; - - case '[': - parser->start = p + 1; - set_state( parser, SECTION_NAME ); - return p + 1; - - default: - if (!isspace(*p)) - { - parser->start = p; - set_state( parser, KEY_NAME ); - return p; - } - break; - } - } - close_current_line( parser ); - return NULL; -} - - -/* handler for parser SECTION_NAME state */ -static const CHAR *section_name_state( struct parser *parser, const CHAR *pos ) -{ - const CHAR *p; - - for (p = pos; !is_eol( parser, p ); p++) - { - if (*p == ']') - { - push_token( parser, p ); - if (add_section_from_token( parser ) == NULL) - return NULL; - push_state( parser, LINE_START ); - set_state( parser, COMMENT ); /* ignore everything else on the line */ - return p + 1; - } - } - parser->error = STATUS_BAD_SECTION_NAME_LINE; /* unfinished section name */ - return NULL; -} - - -/* handler for parser KEY_NAME state */ -static const CHAR *key_name_state( struct parser *parser, const CHAR *pos ) -{ - const CHAR *p, *token_end = parser->start; - - for (p = pos; !is_eol( parser, p ); p++) - { - if (*p == ',') break; - switch(*p) - { - - case '=': - push_token( parser, token_end ); - if (!add_field_from_token( parser, 1 )) return NULL; - parser->start = p + 1; - push_state( parser, VALUE_NAME ); - set_state( parser, LEADING_SPACES ); - return p + 1; - case ';': - push_token( parser, token_end ); - if (!add_field_from_token( parser, 0 )) return NULL; - push_state( parser, LINE_START ); - set_state( parser, COMMENT ); - return p + 1; - case '"': - push_token( parser, token_end ); - parser->start = p + 1; - push_state( parser, KEY_NAME ); - set_state( parser, QUOTES ); - return p + 1; - case '\\': - push_token( parser, token_end ); - parser->start = p; - push_state( parser, KEY_NAME ); - set_state( parser, EOL_BACKSLASH ); - return p; - default: - if (!isspace(*p)) token_end = p + 1; - else - { - push_token( parser, p ); - push_state( parser, KEY_NAME ); - set_state( parser, TRAILING_SPACES ); - return p; - } - break; - } - } - push_token( parser, token_end ); - set_state( parser, VALUE_NAME ); - return p; -} - - -/* handler for parser VALUE_NAME state */ -static const CHAR *value_name_state( struct parser *parser, const CHAR *pos ) -{ - const CHAR *p, *token_end = parser->start; - - for (p = pos; !is_eol( parser, p ); p++) - { - switch(*p) - { - case ';': - push_token( parser, token_end ); - if (!add_field_from_token( parser, 0 )) return NULL; - push_state( parser, LINE_START ); - set_state( parser, COMMENT ); - return p + 1; - case ',': - push_token( parser, token_end ); - if (!add_field_from_token( parser, 0 )) return NULL; - parser->start = p + 1; - push_state( parser, VALUE_NAME ); - set_state( parser, LEADING_SPACES ); - return p + 1; - case '"': - push_token( parser, token_end ); - parser->start = p + 1; - push_state( parser, VALUE_NAME ); - set_state( parser, QUOTES ); - return p + 1; - case '\\': - push_token( parser, token_end ); - parser->start = p; - push_state( parser, VALUE_NAME ); - set_state( parser, EOL_BACKSLASH ); - return p; - default: - if (!isspace(*p)) token_end = p + 1; - else - { - push_token( parser, p ); - push_state( parser, VALUE_NAME ); - set_state( parser, TRAILING_SPACES ); - return p; - } - break; - } - } - push_token( parser, token_end ); - if (!add_field_from_token( parser, 0 )) return NULL; - set_state( parser, LINE_START ); - return p; -} - - -/* handler for parser EOL_BACKSLASH state */ -static const CHAR *eol_backslash_state( struct parser *parser, const CHAR *pos ) -{ - const CHAR *p; - - for (p = pos; !is_eof( parser, p ); p++) - { - switch(*p) - { - case '\r': - continue; - - case '\n': - parser->line_pos++; - parser->start = p + 1; - set_state( parser, LEADING_SPACES ); - return p + 1; - - case '\\': - continue; - - case ';': - push_state( parser, EOL_BACKSLASH ); - set_state( parser, COMMENT ); - return p + 1; - - default: - if (isspace(*p)) - continue; - push_token( parser, p ); - pop_state( parser ); - return p; - } - } - parser->start = p; - pop_state( parser ); - - return p; -} - - -/* handler for parser QUOTES state */ -static const CHAR *quotes_state( struct parser *parser, const CHAR *pos ) -{ - const CHAR *p, *token_end = parser->start; - - for (p = pos; !is_eol( parser, p ); p++) - { - if (*p == '"') - { - if (p+1 < parser->end && p[1] == '"') /* double quotes */ - { - push_token( parser, p + 1 ); - parser->start = token_end = p + 2; - p++; - } - else /* end of quotes */ - { - push_token( parser, p ); - parser->start = p + 1; - pop_state( parser ); - return p + 1; - } - } - } - push_token( parser, p ); - pop_state( parser ); - return p; -} - - -/* handler for parser LEADING_SPACES state */ -static const CHAR *leading_spaces_state( struct parser *parser, const CHAR *pos ) -{ - const CHAR *p; - - for (p = pos; !is_eol( parser, p ); p++) - { - if (*p == '\\') - { - parser->start = p; - set_state( parser, EOL_BACKSLASH ); - return p; - } - if (!isspace(*p)) - break; - } - parser->start = p; - pop_state( parser ); - return p; -} - - -/* handler for parser TRAILING_SPACES state */ -static const CHAR *trailing_spaces_state( struct parser *parser, const CHAR *pos ) -{ - const CHAR *p; - - for (p = pos; !is_eol( parser, p ); p++) - { - if (*p == '\\') - { - set_state( parser, EOL_BACKSLASH ); - return p; - } - if (!isspace(*p)) - break; - } - pop_state( parser ); - return p; -} - - -/* handler for parser COMMENT state */ -static const CHAR *comment_state( struct parser *parser, const CHAR *pos ) -{ - const CHAR *p = pos; - - while (!is_eol( parser, p )) - p++; - pop_state( parser ); - return p; -} - - -/* parse a complete buffer */ -static NTSTATUS -InfpParseBuffer (PINFCACHE file, - const CHAR *buffer, - const CHAR *end, - PULONG error_line) -{ - struct parser parser; - const CHAR *pos = buffer; - - parser.start = buffer; - parser.end = end; - parser.file = file; - parser.line = NULL; - parser.state = LINE_START; - parser.stack_pos = 0; - parser.cur_section = NULL; - parser.line_pos = 1; - parser.error = 0; - parser.token_len = 0; - - /* parser main loop */ - while (pos) - pos = (parser_funcs[parser.state])(&parser, pos); - - if (parser.error) - { - if (error_line) - *error_line = parser.line_pos; - return parser.error; - } - - /* find the [strings] section */ - file->StringsSection = InfpCacheFindSection (file, - L"Strings"); - - return STATUS_SUCCESS; -} - - - -/* PUBLIC FUNCTIONS *********************************************************/ - -NTSTATUS -InfOpenBufferedFile(PHINF InfHandle, - PVOID Buffer, - ULONG BufferSize, - PULONG ErrorLine) -{ - NTSTATUS Status; - PINFCACHE Cache; - PCHAR FileBuffer; - - *InfHandle = NULL; - *ErrorLine = (ULONG)-1; - - /* Allocate file buffer */ - FileBuffer = RtlAllocateHeap(ProcessHeap, - 0, - BufferSize + 1); - if (FileBuffer == NULL) - { - DPRINT1("RtlAllocateHeap() failed\n"); - return(STATUS_INSUFFICIENT_RESOURCES); - } - - RtlCopyMemory(FileBuffer, Buffer, BufferSize); - - /* Append string terminator */ - FileBuffer[BufferSize] = 0; - - /* Allocate infcache header */ - Cache = (PINFCACHE)RtlAllocateHeap(ProcessHeap, - 0, - sizeof(INFCACHE)); - if (Cache == NULL) - { - DPRINT("RtlAllocateHeap() failed\n"); - RtlFreeHeap(ProcessHeap, - 0, - FileBuffer); - return(STATUS_INSUFFICIENT_RESOURCES); - } - - /* Initialize inicache header */ - RtlZeroMemory(Cache, - sizeof(INFCACHE)); - - /* Parse the inf buffer */ - Status = InfpParseBuffer (Cache, - FileBuffer, - FileBuffer + BufferSize, - ErrorLine); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, - 0, - Cache); - Cache = NULL; - } - - /* Free file buffer */ - RtlFreeHeap(ProcessHeap, - 0, - FileBuffer); - - *InfHandle = (HINF)Cache; - - return(Status); -} - - -NTSTATUS -InfOpenFile(PHINF InfHandle, - PUNICODE_STRING FileName, - PULONG ErrorLine) -{ - OBJECT_ATTRIBUTES ObjectAttributes; - FILE_STANDARD_INFORMATION FileInfo; - IO_STATUS_BLOCK IoStatusBlock; - HANDLE FileHandle; - NTSTATUS Status; - PCHAR FileBuffer; - ULONG FileLength; - LARGE_INTEGER FileOffset; - PINFCACHE Cache; - - - *InfHandle = NULL; - *ErrorLine = (ULONG)-1; - - /* Open the inf file */ - InitializeObjectAttributes(&ObjectAttributes, - FileName, - 0, - NULL, - NULL); - - Status = NtOpenFile(&FileHandle, - GENERIC_READ | SYNCHRONIZE, - &ObjectAttributes, - &IoStatusBlock, - FILE_SHARE_READ, - FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE); [truncated at 1000 lines; 1518 more skipped]
19 years, 1 month
1
0
0
0
[gvg] 19516: - Factor out .inf handling code from usetup
by gvg@svn.reactos.com
- Factor out .inf handling code from usetup - Provide a dual interface, for use in build tools and for use in ReactOS code Modified: trunk/reactos/lib/directory.xml Added: trunk/reactos/lib/inflib/ Added: trunk/reactos/lib/inflib/README.txt Added: trunk/reactos/lib/inflib/builddep.h Added: trunk/reactos/lib/inflib/infcommon.h Added: trunk/reactos/lib/inflib/infcore.c Added: trunk/reactos/lib/inflib/infget.c Added: trunk/reactos/lib/inflib/infhost.h Added: trunk/reactos/lib/inflib/infhostgen.c Added: trunk/reactos/lib/inflib/infhostget.c Added: trunk/reactos/lib/inflib/inflib.h Added: trunk/reactos/lib/inflib/inflib.mak Added: trunk/reactos/lib/inflib/inflib.xml Added: trunk/reactos/lib/inflib/infpriv.h Added: trunk/reactos/lib/inflib/infros.h Added: trunk/reactos/lib/inflib/infrosgen.c Added: trunk/reactos/lib/inflib/infrosget.c Modified: trunk/reactos/lib/lib.mak _____ Modified: trunk/reactos/lib/directory.xml --- trunk/reactos/lib/directory.xml 2005-11-24 06:07:04 UTC (rev 19515) +++ trunk/reactos/lib/directory.xml 2005-11-24 08:07:12 UTC (rev 19516) @@ -119,6 +119,9 @@ <directory name="imm32"> <xi:include href="imm32/imm32.xml" /> </directory> +<directory name="inflib"> + <xi:include href="inflib/inflib.xml" /> +</directory> <directory name="intrlck"> <xi:include href="intrlck/intrlck.xml" /> </directory> _____ Added: trunk/reactos/lib/inflib/README.txt --- trunk/reactos/lib/inflib/README.txt 2005-11-24 06:07:04 UTC (rev 19515) +++ trunk/reactos/lib/inflib/README.txt 2005-11-24 08:07:12 UTC (rev 19516) @@ -0,0 +1,14 @@ +Routines to handle .inf files. + +This library is used to share .inf handling code between build tools and +ReactOS code. Two versions are built, "inflib_host" (for use by build tools) +and "inflib" (for use by ReactOS code). Both depend on the same core source, +with a wrapper for the appropriate interface. +Most of the differences between the host and the ReactOS environment are +abstracted away in builddep.h. Of particular note is that the host version +uses Ansi characters while the ReactOS version uses Unicode. So, the core +source uses TCHARs. builddep.h depends on a preprocessor variable INFLIB_HOST +which is defined when building the host version (inflib.mak) but not defined +when building the ReactOS version (inflib.xml). +The wrappers have "host" or "ros" in their filename. The library interface is +"infhost.h" for the host version, "infros.h" for the ReactOS version. Property changes on: trunk/reactos/lib/inflib/README.txt ___________________________________________________________________ Name: svn:eol-style + native _____ Added: trunk/reactos/lib/inflib/builddep.h --- trunk/reactos/lib/inflib/builddep.h 2005-11-24 06:07:04 UTC (rev 19515) +++ trunk/reactos/lib/inflib/builddep.h 2005-11-24 08:07:12 UTC (rev 19516) @@ -0,0 +1,75 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: .inf file parser + * FILE: lib/inflib/builddep.h + * PURPOSE: Build dependent definitions + * PROGRAMMER: Ge van Geldorp <gvg(a)reactos.org> + */ + +#ifdef INFLIB_HOST + +/* Definitions native to the host on which we're building */ + +#include <string.h> +#include <errno.h> + +#define FREE(Area) free(Area) +#define MALLOC(Size) malloc(Size) +#define ZEROMEMORY(Area, Size) memset((Area), '\0', (Size)) +#define MEMCPY(Dest, Src, Size) memcpy((Dest), (Src), (Size)) + +#define INF_STATUS_SUCCESS 0 +#define INF_STATUS_NO_MEMORY ENOMEM +#define INF_STATUS_INVALID_PARAMETER EINVAL +#define INF_STATUS_NOT_FOUND ENOENT +#define INF_STATUS_BUFFER_OVERFLOW E2BIG +#define INF_SUCCESS(x) (0 == (x)) + +typedef char CHAR, *PCHAR; +typedef unsigned char UCHAR, *PUCHAR; +typedef long LONG, *PLONG; +typedef unsigned long ULONG, *PULONG; +typedef void VOID, *PVOID; +typedef UCHAR BOOLEAN, *PBOOLEAN; + +typedef char TCHAR, *PTCHAR, *PTSTR; +#define _T(x) x +#define _tcsicmp strcasecmp +#define _tcslen strlen +#define _tcscpy strcpy +#define _tcstoul strtoul +#define _tcstol strtol + +extern void DbgPrint(const char *Fmt, ...); + +#else /* ! defined(INFLIB_HOST) */ + +/* ReactOS definitions */ + +#define UNICODE +#define _UNICODE +#include <tchar.h> +#define WIN32_NO_STATUS +#include <windows.h> +#define NTOS_MODE_USER +#include <ndk/ntndk.h> + +extern PVOID InfpHeap; + +#define FREE(Area) RtlFreeHeap(InfpHeap, 0, (Area)) +#define MALLOC(Size) RtlAllocateHeap(InfpHeap, 0, (Size)) +#define ZEROMEMORY(Area, Size) RtlZeroMemory((Area), (Size)) +#define MEMCPY(Dest, Src, Size) RtlCopyMemory((Dest), (Src), (Size)) + +#define INF_STATUS_SUCCESS STATUS_SUCCESS +#define INF_STATUS_NO_MEMORY STATUS_NO_MEMORY +#define INF_STATUS_INVALID_PARAMETER STATUS_INVALID_PARAMETER +#define INF_STATUS_NOT_FOUND STATUS_NOT_FOUND +#define INF_STATUS_BUFFER_OVERFLOW STATUS_BUFFER_OVERFLOW +#define INF_SUCCESS(x) (0 <= (x)) + +#endif /* INFLIB_HOST */ + +typedef const TCHAR *PCTSTR; + +/* EOF */ Property changes on: trunk/reactos/lib/inflib/builddep.h ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native _____ Added: trunk/reactos/lib/inflib/infcommon.h --- trunk/reactos/lib/inflib/infcommon.h 2005-11-24 06:07:04 UTC (rev 19515) +++ trunk/reactos/lib/inflib/infcommon.h 2005-11-24 08:07:12 UTC (rev 19516) @@ -0,0 +1,21 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: .inf file parser + * FILE: lib/inflib/infcommon.h + * PURPOSE: Public .inf routines + * PROGRAMMER: Royce Mitchell III + * Eric Kohl + * Ge van Geldorp + */ + +#ifndef INFCOMMON_H_INCLUDED +#define INFCOMMON_H_INCLUDED + +#define MAX_INF_STRING_LENGTH 512 + +typedef void *HINF, **PHINF; +typedef struct _INFCONTEXT *PINFCONTEXT; + +#endif /* INFCOMMON_H_INCLUDED */ + +/* EOF */ Property changes on: trunk/reactos/lib/inflib/infcommon.h ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native _____ Copied: trunk/reactos/lib/inflib/infcore.c (from rev 19508, trunk/reactos/subsys/system/usetup/infcache.c) --- trunk/reactos/subsys/system/usetup/infcache.c 2005-11-23 23:02:35 UTC (rev 19508) +++ trunk/reactos/lib/inflib/infcore.c 2005-11-24 08:07:12 UTC (rev 19516) @@ -0,0 +1,811 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: .inf file parser + * FILE: lib/inflib/infcore.c + * PURPOSE: INF file parser that caches contents of INF file in memory + * PROGRAMMER: Royce Mitchell III + * Eric Kohl + * Ge van Geldorp + */ + +/* INCLUDES *****************************************************************/ + +#include "inflib.h" + +#define NDEBUG +#include <debug.h> + +#define CONTROL_Z '\x1a' +#define MAX_SECTION_NAME_LEN 255 +#define MAX_FIELD_LEN 511 /* larger fields get silently truncated */ +/* actual string limit is MAX_INF_STRING_LENGTH+1 (plus terminating null) under Windows */ +#define MAX_STRING_LEN (MAX_INF_STRING_LENGTH+1) + + +/* parser definitions */ + +enum parser_state +{ + LINE_START, /* at beginning of a line */ + SECTION_NAME, /* parsing a section name */ + KEY_NAME, /* parsing a key name */ + VALUE_NAME, /* parsing a value name */ + EOL_BACKSLASH, /* backslash at end of line */ + QUOTES, /* inside quotes */ + LEADING_SPACES, /* leading spaces */ + TRAILING_SPACES, /* trailing spaces */ + COMMENT, /* inside a comment */ + NB_PARSER_STATES +}; + +struct parser +{ + const CHAR *start; /* start position of item being parsed */ + const CHAR *end; /* end of buffer */ + PINFCACHE file; /* file being built */ + enum parser_state state; /* current parser state */ + enum parser_state stack[4]; /* state stack */ + int stack_pos; /* current pos in stack */ + + PINFCACHESECTION cur_section; /* pointer to the section being parsed*/ + PINFCACHELINE line; /* current line */ + unsigned int line_pos; /* current line position in file */ + unsigned int error; /* error code */ + unsigned int token_len; /* current token len */ + TCHAR token[MAX_FIELD_LEN+1]; /* current token */ +}; + +typedef const CHAR * (*parser_state_func)( struct parser *parser, const CHAR *pos ); + +/* parser state machine functions */ +static const CHAR *line_start_state( struct parser *parser, const CHAR *pos ); +static const CHAR *section_name_state( struct parser *parser, const CHAR *pos ); +static const CHAR *key_name_state( struct parser *parser, const CHAR *pos ); +static const CHAR *value_name_state( struct parser *parser, const CHAR *pos ); +static const CHAR *eol_backslash_state( struct parser *parser, const CHAR *pos ); +static const CHAR *quotes_state( struct parser *parser, const CHAR *pos ); +static const CHAR *leading_spaces_state( struct parser *parser, const CHAR *pos ); +static const CHAR *trailing_spaces_state( struct parser *parser, const CHAR *pos ); +static const CHAR *comment_state( struct parser *parser, const CHAR *pos ); + +static const parser_state_func parser_funcs[NB_PARSER_STATES] = +{ + line_start_state, /* LINE_START */ + section_name_state, /* SECTION_NAME */ + key_name_state, /* KEY_NAME */ + value_name_state, /* VALUE_NAME */ + eol_backslash_state, /* EOL_BACKSLASH */ + quotes_state, /* QUOTES */ + leading_spaces_state, /* LEADING_SPACES */ + trailing_spaces_state, /* TRAILING_SPACES */ + comment_state /* COMMENT */ +}; + + +/* PRIVATE FUNCTIONS ********************************************************/ + +static PINFCACHELINE +InfpCacheFreeLine (PINFCACHELINE Line) +{ + PINFCACHELINE Next; + PINFCACHEFIELD Field; + + if (Line == NULL) + { + return NULL; + } + + Next = Line->Next; + if (Line->Key != NULL) + { + FREE (Line->Key); + Line->Key = NULL; + } + + /* Remove data fields */ + while (Line->FirstField != NULL) + { + Field = Line->FirstField->Next; + FREE (Line->FirstField); + Line->FirstField = Field; + } + Line->LastField = NULL; + + FREE (Line); + + return Next; +} + + +PINFCACHESECTION +InfpCacheFreeSection (PINFCACHESECTION Section) +{ + PINFCACHESECTION Next; + + if (Section == NULL) + { + return NULL; + } + + /* Release all keys */ + Next = Section->Next; + while (Section->FirstLine != NULL) + { + Section->FirstLine = InfpCacheFreeLine (Section->FirstLine); + } + Section->LastLine = NULL; + + FREE (Section); + + return Next; +} + + +static PINFCACHESECTION +InfpCacheFindSection (PINFCACHE Cache, + PCTSTR Name) +{ + PINFCACHESECTION Section = NULL; + + if (Cache == NULL || Name == NULL) + { + return NULL; + } + + /* iterate through list of sections */ + Section = Cache->FirstSection; + while (Section != NULL) + { + if (_tcsicmp (Section->Name, Name) == 0) + { + return Section; + } + + /* get the next section*/ + Section = Section->Next; + } + + return NULL; +} + + +static PINFCACHESECTION +InfpCacheAddSection (PINFCACHE Cache, + PTCHAR Name) +{ + PINFCACHESECTION Section = NULL; + ULONG Size; + + if (Cache == NULL || Name == NULL) + { + DPRINT("Invalid parameter\n"); + return NULL; + } + + /* Allocate and initialize the new section */ + Size = sizeof(INFCACHESECTION) + (_tcslen (Name) * sizeof(TCHAR)); + Section = (PINFCACHESECTION)MALLOC (Size); + if (Section == NULL) + { + DPRINT("MALLOC() failed\n"); + return NULL; + } + ZEROMEMORY (Section, + Size); + + /* Copy section name */ + _tcscpy (Section->Name, Name); + + /* Append section */ + if (Cache->FirstSection == NULL) + { + Cache->FirstSection = Section; + Cache->LastSection = Section; + } + else + { + Cache->LastSection->Next = Section; + Section->Prev = Cache->LastSection; + Cache->LastSection = Section; + } + + return Section; +} + + +static PINFCACHELINE +InfpCacheAddLine (PINFCACHESECTION Section) +{ + PINFCACHELINE Line; + + if (Section == NULL) + { + DPRINT("Invalid parameter\n"); + return NULL; + } + + Line = (PINFCACHELINE)MALLOC (sizeof(INFCACHELINE)); + if (Line == NULL) + { + DPRINT("MALLOC() failed\n"); + return NULL; + } + ZEROMEMORY(Line, + sizeof(INFCACHELINE)); + + /* Append line */ + if (Section->FirstLine == NULL) + { + Section->FirstLine = Line; + Section->LastLine = Line; + } + else + { + Section->LastLine->Next = Line; + Line->Prev = Section->LastLine; + Section->LastLine = Line; + } + Section->LineCount++; + + return Line; +} + + +static PVOID +InfpAddKeyToLine (PINFCACHELINE Line, + PTCHAR Key) +{ + if (Line == NULL) + return NULL; + + if (Line->Key != NULL) + return NULL; + + Line->Key = (PTCHAR)MALLOC ((_tcslen (Key) + 1) * sizeof(TCHAR)); + if (Line->Key == NULL) + return NULL; + + _tcscpy (Line->Key, Key); + + return (PVOID)Line->Key; +} + + +static PVOID +InfpAddFieldToLine (PINFCACHELINE Line, + PTCHAR Data) +{ + PINFCACHEFIELD Field; + ULONG Size; + + Size = sizeof(INFCACHEFIELD) + (_tcslen(Data) * sizeof(TCHAR)); + Field = (PINFCACHEFIELD)MALLOC (Size); + if (Field == NULL) + { + return NULL; + } + ZEROMEMORY (Field, + Size); + _tcscpy (Field->Data, Data); + + /* Append key */ + if (Line->FirstField == NULL) + { + Line->FirstField = Field; + Line->LastField = Field; + } + else + { + Line->LastField->Next = Field; + Field->Prev = Line->LastField; + Line->LastField = Field; + } + Line->FieldCount++; + + return (PVOID)Field; +} + + +PINFCACHELINE +InfpCacheFindKeyLine (PINFCACHESECTION Section, + PTCHAR Key) +{ + PINFCACHELINE Line; + + Line = Section->FirstLine; + while (Line != NULL) + { + if (Line->Key != NULL && _tcsicmp (Line->Key, Key) == 0) + { + return Line; + } + + Line = Line->Next; + } + + return NULL; +} + + +/* push the current state on the parser stack */ +inline static void push_state( struct parser *parser, enum parser_state state ) +{ +// assert( parser->stack_pos < sizeof(parser->stack)/sizeof(parser->stack[0]) ); + parser->stack[parser->stack_pos++] = state; +} + + +/* pop the current state */ +inline static void pop_state( struct parser *parser ) +{ +// assert( parser->stack_pos ); + parser->state = parser->stack[--parser->stack_pos]; +} + + +/* set the parser state and return the previous one */ +inline static enum parser_state set_state( struct parser *parser, enum parser_state state ) +{ + enum parser_state ret = parser->state; + parser->state = state; + return ret; +} + + +/* check if the pointer points to an end of file */ +inline static int is_eof( struct parser *parser, const CHAR *ptr ) +{ + return (ptr >= parser->end || *ptr == CONTROL_Z); +} + + +/* check if the pointer points to an end of line */ +inline static int is_eol( struct parser *parser, const CHAR *ptr ) +{ + return (ptr >= parser->end || + *ptr == CONTROL_Z || + *ptr == '\n' || + (*ptr == '\r' && *(ptr + 1) == '\n')); +} + + +/* push data from current token start up to pos into the current token */ +static int push_token( struct parser *parser, const CHAR *pos ) +{ + unsigned int len = pos - parser->start; + const CHAR *src = parser->start; + TCHAR *dst = parser->token + parser->token_len; + + if (len > MAX_FIELD_LEN - parser->token_len) + len = MAX_FIELD_LEN - parser->token_len; + + parser->token_len += len; + for ( ; len > 0; len--, dst++, src++) + *dst = *src ? (TCHAR)*src : L' '; + *dst = 0; + parser->start = pos; + + return 0; +} + + + +/* add a section with the current token as name */ +static PVOID add_section_from_token( struct parser *parser ) +{ + PINFCACHESECTION Section; + + if (parser->token_len > MAX_SECTION_NAME_LEN) + { + parser->error = INF_STATUS_SECTION_NAME_TOO_LONG; + return NULL; + } + + Section = InfpCacheFindSection (parser->file, + parser->token); + if (Section == NULL) + { + /* need to create a new one */ + Section= InfpCacheAddSection (parser->file, + parser->token); + if (Section == NULL) + { + parser->error = INF_STATUS_NOT_ENOUGH_MEMORY; + return NULL; + } + } + + parser->token_len = 0; + parser->cur_section = Section; + + return (PVOID)Section; +} + + +/* add a field containing the current token to the current line */ +static struct field *add_field_from_token( struct parser *parser, int is_key ) +{ + PVOID field; + + if (!parser->line) /* need to start a new line */ + { + if (parser->cur_section == NULL) /* got a line before the first section */ + { + parser->error = INF_STATUS_WRONG_INF_STYLE; + return NULL; + } + + parser->line = InfpCacheAddLine (parser->cur_section); + if (parser->line == NULL) + goto error; + } + else + { +// assert(!is_key); + } + + if (is_key) + { + field = InfpAddKeyToLine(parser->line, parser->token); + } + else + { + field = InfpAddFieldToLine(parser->line, parser->token); + } + + if (field != NULL) + { + parser->token_len = 0; + return field; + } + +error: + parser->error = INF_STATUS_NOT_ENOUGH_MEMORY; + return NULL; +} + + +/* close the current line and prepare for parsing a new one */ +static void close_current_line( struct parser *parser ) +{ + parser->line = NULL; +} + + + +/* handler for parser LINE_START state */ +static const CHAR *line_start_state( struct parser *parser, const CHAR *pos ) +{ + const CHAR *p; + + for (p = pos; !is_eof( parser, p ); p++) + { + switch(*p) + { + case '\r': + continue; + + case '\n': + parser->line_pos++; + close_current_line( parser ); + break; + + case ';': + push_state( parser, LINE_START ); + set_state( parser, COMMENT ); + return p + 1; + + case '[': + parser->start = p + 1; + set_state( parser, SECTION_NAME ); + return p + 1; + + default: + if (!isspace(*p)) + { + parser->start = p; + set_state( parser, KEY_NAME ); + return p; + } + break; + } + } + close_current_line( parser ); + return NULL; +} + + +/* handler for parser SECTION_NAME state */ +static const CHAR *section_name_state( struct parser *parser, const CHAR *pos ) +{ + const CHAR *p; + + for (p = pos; !is_eol( parser, p ); p++) + { + if (*p == ']') + { + push_token( parser, p ); + if (add_section_from_token( parser ) == NULL) + return NULL; + push_state( parser, LINE_START ); + set_state( parser, COMMENT ); /* ignore everything else on the line */ + return p + 1; + } + } + parser->error = INF_STATUS_BAD_SECTION_NAME_LINE; /* unfinished section name */ + return NULL; +} + + +/* handler for parser KEY_NAME state */ +static const CHAR *key_name_state( struct parser *parser, const CHAR *pos ) +{ + const CHAR *p, *token_end = parser->start; + + for (p = pos; !is_eol( parser, p ); p++) + { + if (*p == ',') break; + switch(*p) + { + + case '=': + push_token( parser, token_end ); + if (!add_field_from_token( parser, 1 )) return NULL; + parser->start = p + 1; + push_state( parser, VALUE_NAME ); + set_state( parser, LEADING_SPACES ); + return p + 1; + case ';': + push_token( parser, token_end ); + if (!add_field_from_token( parser, 0 )) return NULL; + push_state( parser, LINE_START ); + set_state( parser, COMMENT ); + return p + 1; + case '"': + push_token( parser, token_end ); + parser->start = p + 1; + push_state( parser, KEY_NAME ); + set_state( parser, QUOTES ); + return p + 1; + case '\\': + push_token( parser, token_end ); + parser->start = p; + push_state( parser, KEY_NAME ); + set_state( parser, EOL_BACKSLASH ); + return p; + default: + if (!isspace(*p)) token_end = p + 1; + else + { + push_token( parser, p ); + push_state( parser, KEY_NAME ); + set_state( parser, TRAILING_SPACES ); + return p; + } + break; + } + } + push_token( parser, token_end ); + set_state( parser, VALUE_NAME ); + return p; +} + + +/* handler for parser VALUE_NAME state */ +static const CHAR *value_name_state( struct parser *parser, const CHAR *pos ) +{ + const CHAR *p, *token_end = parser->start; + + for (p = pos; !is_eol( parser, p ); p++) + { + switch(*p) + { + case ';': + push_token( parser, token_end ); + if (!add_field_from_token( parser, 0 )) return NULL; + push_state( parser, LINE_START ); + set_state( parser, COMMENT ); + return p + 1; + case ',': + push_token( parser, token_end ); + if (!add_field_from_token( parser, 0 )) return NULL; + parser->start = p + 1; + push_state( parser, VALUE_NAME ); + set_state( parser, LEADING_SPACES ); + return p + 1; + case '"': + push_token( parser, token_end ); + parser->start = p + 1; + push_state( parser, VALUE_NAME ); + set_state( parser, QUOTES ); + return p + 1; + case '\\': + push_token( parser, token_end ); + parser->start = p; + push_state( parser, VALUE_NAME ); + set_state( parser, EOL_BACKSLASH ); + return p; + default: + if (!isspace(*p)) token_end = p + 1; + else + { + push_token( parser, p ); + push_state( parser, VALUE_NAME ); + set_state( parser, TRAILING_SPACES ); + return p; + } + break; + } + } + push_token( parser, token_end ); + if (!add_field_from_token( parser, 0 )) return NULL; + set_state( parser, LINE_START ); + return p; +} + + +/* handler for parser EOL_BACKSLASH state */ +static const CHAR *eol_backslash_state( struct parser *parser, const CHAR *pos ) +{ + const CHAR *p; + + for (p = pos; !is_eof( parser, p ); p++) + { + switch(*p) + { + case '\r': + continue; + + case '\n': + parser->line_pos++; + parser->start = p + 1; + set_state( parser, LEADING_SPACES ); + return p + 1; + + case '\\': + continue; + + case ';': + push_state( parser, EOL_BACKSLASH ); + set_state( parser, COMMENT ); + return p + 1; + + default: + if (isspace(*p)) + continue; + push_token( parser, p ); + pop_state( parser ); + return p; + } + } + parser->start = p; + pop_state( parser ); + + return p; +} + + +/* handler for parser QUOTES state */ +static const CHAR *quotes_state( struct parser *parser, const CHAR *pos ) +{ + const CHAR *p, *token_end = parser->start; + + for (p = pos; !is_eol( parser, p ); p++) + { + if (*p == '"') + { + if (p+1 < parser->end && p[1] == '"') /* double quotes */ + { + push_token( parser, p + 1 ); + parser->start = token_end = p + 2; + p++; + } + else /* end of quotes */ + { + push_token( parser, p ); + parser->start = p + 1; + pop_state( parser ); + return p + 1; + } + } + } + push_token( parser, p ); + pop_state( parser ); + return p; +} + + +/* handler for parser LEADING_SPACES state */ +static const CHAR *leading_spaces_state( struct parser *parser, const CHAR *pos ) +{ + const CHAR *p; + + for (p = pos; !is_eol( parser, p ); p++) + { + if (*p == '\\') + { + parser->start = p; + set_state( parser, EOL_BACKSLASH ); + return p; + } + if (!isspace(*p)) + break; + } + parser->start = p; + pop_state( parser ); + return p; +} + + +/* handler for parser TRAILING_SPACES state */ +static const CHAR *trailing_spaces_state( struct parser *parser, const CHAR *pos ) +{ + const CHAR *p; + + for (p = pos; !is_eol( parser, p ); p++) + { + if (*p == '\\') + { + set_state( parser, EOL_BACKSLASH ); + return p; + } + if (!isspace(*p)) + break; + } + pop_state( parser ); + return p; +} + + +/* handler for parser COMMENT state */ +static const CHAR *comment_state( struct parser *parser, const CHAR *pos ) +{ + const CHAR *p = pos; + + while (!is_eol( parser, p )) + p++; + pop_state( parser ); + return p; +} + + +/* parse a complete buffer */ +INFSTATUS +InfpParseBuffer (PINFCACHE file, + const CHAR *buffer, + const CHAR *end, + PULONG error_line) +{ + struct parser parser; + const CHAR *pos = buffer; + + parser.start = buffer; + parser.end = end; + parser.file = file; + parser.line = NULL; + parser.state = LINE_START; + parser.stack_pos = 0; + parser.cur_section = NULL; + parser.line_pos = 1; + parser.error = 0; + parser.token_len = 0; + + /* parser main loop */ + while (pos) + pos = (parser_funcs[parser.state])(&parser, pos); + + if (parser.error) + { + if (error_line) + *error_line = parser.line_pos; + return parser.error; + } + + /* find the [strings] section */ + file->StringsSection = InfpCacheFindSection (file, + _T("Strings")); + + return INF_STATUS_SUCCESS; +} + +/* EOF */ _____ Copied: trunk/reactos/lib/inflib/infget.c (from rev 19508, trunk/reactos/subsys/system/usetup/infcache.c) --- trunk/reactos/subsys/system/usetup/infcache.c 2005-11-23 23:02:35 UTC (rev 19508) +++ trunk/reactos/lib/inflib/infget.c 2005-11-24 08:07:12 UTC (rev 19516) @@ -0,0 +1,529 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: .inf file parser + * FILE: lib/inflib/infrosget.c + * PURPOSE: Read .inf routines for use in ReactOS + * PROGRAMMER: Royce Mitchell III + * Eric Kohl + * Ge van Geldorp + */ + +/* INCLUDES *****************************************************************/ + +#include "inflib.h" + +#define NDEBUG +#include <debug.h> + + +INFSTATUS +InfpFindFirstLine(HINF InfHandle, + PCTSTR Section, + PCTSTR Key, + PINFCONTEXT *Context) +{ [truncated at 1000 lines; 1832 more skipped]
19 years, 1 month
1
0
0
0
[sedwards] 19515: more msvc compile fixes by Brezenbak and I
by sedwards@svn.reactos.com
more msvc compile fixes by Brezenbak and I Modified: trunk/reactos/lib/crt/float/logb.c Modified: trunk/reactos/lib/crt/include/float.h Modified: trunk/reactos/lib/crt/include/internal/file.h Modified: trunk/reactos/lib/crt/include/internal/mbstring.h Modified: trunk/reactos/lib/crt/io/access.c Modified: trunk/reactos/lib/crt/io/chmod.c Modified: trunk/reactos/lib/crt/io/tell.c Modified: trunk/reactos/lib/crt/io/wutime.c Modified: trunk/reactos/lib/crt/precomp.h Modified: trunk/reactos/lib/crt/process/dll.c Modified: trunk/reactos/lib/crt/signal/signal.c Modified: trunk/reactos/lib/crt/stdio/fopen.c Modified: trunk/reactos/lib/crt/stdio/fputc.c Modified: trunk/reactos/lib/crt/stdio/freopen.c Modified: trunk/reactos/lib/crt/stdio/fsopen.c Modified: trunk/reactos/lib/crt/stdio/vfprintf.c Modified: trunk/reactos/lib/crt/stdio/vfwprint.c Modified: trunk/reactos/lib/crt/stdlib/senv.c Modified: trunk/reactos/lib/crt/stdlib/strtoull.c Modified: trunk/reactos/lib/crt/sys_stat/fstat.c Modified: trunk/reactos/lib/crt/time/difftime.c _____ Modified: trunk/reactos/lib/crt/float/logb.c --- trunk/reactos/lib/crt/float/logb.c 2005-11-24 01:49:36 UTC (rev 19514) +++ trunk/reactos/lib/crt/float/logb.c 2005-11-24 06:07:04 UTC (rev 19515) @@ -22,13 +22,13 @@ double _logb (double __x) { - register double __value; + register double __val; #ifdef __GNUC__ register double __junk; __asm __volatile__ ("fxtract\n\t" - : "=t" (__junk), "=u" (__value) : "0" (__x)); + : "=t" (__junk), "=u" (__val) : "0" (__x)); #else #endif /*__GNUC__*/ - return __value; + return __val; } _____ Modified: trunk/reactos/lib/crt/include/float.h --- trunk/reactos/lib/crt/include/float.h 2005-11-24 01:49:36 UTC (rev 19514) +++ trunk/reactos/lib/crt/include/float.h 2005-11-24 06:07:04 UTC (rev 19515) @@ -15,15 +15,16 @@ * here. * */ - -#include_next<float.h> - +#ifdef __GNUC__ + #include_next <float.h> +#endif #ifndef _MINGW_FLOAT_H_ #define _MINGW_FLOAT_H_ /* All the headers include this file. */ -#include <_mingw.h> - +#ifdef __GNUC__ + #include <_mingw.h> +#endif /* * Functions and definitions for controlling the FPU. */ @@ -90,12 +91,24 @@ #define _FPE_STACKUNDERFLOW 0x8b #define _FPE_EXPLICITGEN 0x8c /* raise( SIGFPE ); */ +#define DBL_MAX_10_EXP 308 +#define S_IFIFO -1 +#define UINT64_MAX 0xffffffffffffffff + #ifndef RC_INVOKED #ifdef __cplusplus extern "C" { #endif +#ifndef _CRTIMP +#ifdef _DLL +#define _CRTIMP __declspec(dllimport) +#else +#define _CRTIMP +#endif /* _DLL */ +#endif + /* Set the FPU control word as cw = (cw & ~unMask) | (unNew & unMask), * i.e. change the bits in unMask to have the values they have in unNew, * leaving other bits unchanged. */ _____ Modified: trunk/reactos/lib/crt/include/internal/file.h --- trunk/reactos/lib/crt/include/internal/file.h 2005-11-24 01:49:36 UTC (rev 19514) +++ trunk/reactos/lib/crt/include/internal/file.h 2005-11-24 06:07:04 UTC (rev 19515) @@ -16,7 +16,9 @@ #include <stdio.h> #include <fcntl.h> #include <stdarg.h> +#include <time.h> + #include <windef.h> #include <winbase.h> #include <winnt.h> _____ Modified: trunk/reactos/lib/crt/include/internal/mbstring.h --- trunk/reactos/lib/crt/include/internal/mbstring.h 2005-11-24 01:49:36 UTC (rev 19514) +++ trunk/reactos/lib/crt/include/internal/mbstring.h 2005-11-24 06:07:04 UTC (rev 19515) @@ -18,5 +18,20 @@ #endif #define _P2 (_P_|__2) +#if defined (_MSC_VER) +#undef _ismbbkana +#undef _ismbbkpunct +#undef _ismbbalpha +#undef _ismbbalnum +#undef _ismbbgraph +#undef _ismbbkalnum +#undef _ismbblead +#undef _ismbbprint +#undef _ismbbpunct +#undef _ismbbtrail + #endif + + +#endif _____ Modified: trunk/reactos/lib/crt/io/access.c --- trunk/reactos/lib/crt/io/access.c 2005-11-24 01:49:36 UTC (rev 19514) +++ trunk/reactos/lib/crt/io/access.c 2005-11-24 06:07:04 UTC (rev 19515) @@ -20,7 +20,7 @@ int _taccess( const _TCHAR *_path, int _amode ) { DWORD Attributes = GetFileAttributes(_path); - DPRINT(MK_STR(_taccess)"('%"_TS"', %x)\n", _path, _amode); + DPRINT(MK_STR(_taccess)"('%"sT"', %x)\n", _path, _amode); if (Attributes == (DWORD)-1) { _dosmaperr(GetLastError()); @@ -44,7 +44,7 @@ int access_dirT(const _TCHAR *_path) { DWORD Attributes = GetFileAttributes(_path); - DPRINT(MK_STR(is_dirT)"('%"_TS"')\n", _path); + DPRINT(MK_STR(is_dirT)"('%"sT"')\n", _path); if (Attributes == (DWORD)-1) { _dosmaperr(GetLastError()); _____ Modified: trunk/reactos/lib/crt/io/chmod.c --- trunk/reactos/lib/crt/io/chmod.c 2005-11-24 01:49:36 UTC (rev 19514) +++ trunk/reactos/lib/crt/io/chmod.c 2005-11-24 06:07:04 UTC (rev 19515) @@ -20,7 +20,7 @@ DWORD FileAttributes = 0; BOOLEAN Set = FALSE; - DPRINT(#_tchmod"('%"sT"', %x)\n", filename, mode); + DPRINT(MK_STR(_tchmod)"('%"sT"', %x)\n", filename, mode); FileAttributes = GetFileAttributes(filename); if ( FileAttributes == (DWORD)-1 ) { _____ Modified: trunk/reactos/lib/crt/io/tell.c --- trunk/reactos/lib/crt/io/tell.c 2005-11-24 01:49:36 UTC (rev 19514) +++ trunk/reactos/lib/crt/io/tell.c 2005-11-24 06:07:04 UTC (rev 19515) @@ -2,8 +2,8 @@ #include <errno.h> #include <io.h> #include <stdio.h> +#include <sys/types.h> - /* * @implemented */ _____ Modified: trunk/reactos/lib/crt/io/wutime.c --- trunk/reactos/lib/crt/io/wutime.c 2005-11-24 01:49:36 UTC (rev 19514) +++ trunk/reactos/lib/crt/io/wutime.c 2005-11-24 06:07:04 UTC (rev 19515) @@ -1,3 +1,4 @@ +#include "precomp.h" #include <stdio.h> #include <io.h> #include <errno.h> @@ -4,7 +5,6 @@ #include <sys/utime.h> #include <internal/file.h> - /* * @implemented */ @@ -23,3 +23,4 @@ return -1; return ret; } + _____ Modified: trunk/reactos/lib/crt/precomp.h --- trunk/reactos/lib/crt/precomp.h 2005-11-24 01:49:36 UTC (rev 19514) +++ trunk/reactos/lib/crt/precomp.h 2005-11-24 06:07:04 UTC (rev 19515) @@ -1,4 +1,7 @@ #define CRT_SECURE_NO_DEPRECATE +#define _INC_WTIME_INL +#define _INC_UTIME_INL +#define _INC_TIME_INL #define WIN32_NO_STATUS #include <windows.h> _____ Modified: trunk/reactos/lib/crt/process/dll.c --- trunk/reactos/lib/crt/process/dll.c 2005-11-24 01:49:36 UTC (rev 19514) +++ trunk/reactos/lib/crt/process/dll.c 2005-11-24 06:07:04 UTC (rev 19515) @@ -9,7 +9,6 @@ */ #include "precomp.h" -#include <process.h> /* * @implemented _____ Modified: trunk/reactos/lib/crt/signal/signal.c --- trunk/reactos/lib/crt/signal/signal.c 2005-11-24 01:49:36 UTC (rev 19514) +++ trunk/reactos/lib/crt/signal/signal.c 2005-11-24 06:07:04 UTC (rev 19515) @@ -8,7 +8,7 @@ void _default_handler(int signal); -//typedef void (*_p_sig_fn_t)(int); +typedef void (*__p_sig_fn_t)(int); typedef struct _sig_element _____ Modified: trunk/reactos/lib/crt/stdio/fopen.c --- trunk/reactos/lib/crt/stdio/fopen.c 2005-11-24 01:49:36 UTC (rev 19514) +++ trunk/reactos/lib/crt/stdio/fopen.c 2005-11-24 06:07:04 UTC (rev 19515) @@ -29,6 +29,7 @@ #include <sys/types.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <io.h> #include <fcntl.h> _____ Modified: trunk/reactos/lib/crt/stdio/fputc.c --- trunk/reactos/lib/crt/stdio/fputc.c 2005-11-24 01:49:36 UTC (rev 19514) +++ trunk/reactos/lib/crt/stdio/fputc.c 2005-11-24 06:07:04 UTC (rev 19515) @@ -23,3 +23,4 @@ return putwc(c,fp); } + _____ Modified: trunk/reactos/lib/crt/stdio/freopen.c --- trunk/reactos/lib/crt/stdio/freopen.c 2005-11-24 01:49:36 UTC (rev 19514) +++ trunk/reactos/lib/crt/stdio/freopen.c 2005-11-24 06:07:04 UTC (rev 19515) @@ -4,6 +4,7 @@ #include <sys/types.h> #include <stdio.h> +#include <stdlib.h> #include <fcntl.h> #include <io.h> #include <tchar.h> _____ Modified: trunk/reactos/lib/crt/stdio/fsopen.c --- trunk/reactos/lib/crt/stdio/fsopen.c 2005-11-24 01:49:36 UTC (rev 19514) +++ trunk/reactos/lib/crt/stdio/fsopen.c 2005-11-24 06:07:04 UTC (rev 19515) @@ -14,6 +14,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> +#include <stdlib.h> #include <io.h> #include <fcntl.h> #include <share.h> _____ Modified: trunk/reactos/lib/crt/stdio/vfprintf.c --- trunk/reactos/lib/crt/stdio/vfprintf.c 2005-11-24 01:49:36 UTC (rev 19514) +++ trunk/reactos/lib/crt/stdio/vfprintf.c 2005-11-24 06:07:04 UTC (rev 19515) @@ -450,6 +450,7 @@ static int stringw(FILE *f, const wchar_t* sw, int len, int field_width, int precision, int flags) { int i, done = 0; + char * mb; if (sw == NULL) { sw = L"<NULL>"; @@ -476,10 +477,11 @@ return -1; done++; } + mb = malloc(MB_CUR_MAX * sizeof(char)); + if(!mb) + return -1; for (i = 0; i < len; ++i) { -//#define MB_CUR_MAX 1 - char mb[MB_CUR_MAX]; int mbcount, j; mbcount = wctomb(mb, *sw++); if (mbcount <= 0) @@ -489,16 +491,23 @@ for (j = 0; j < mbcount; j++) { if (putc(mb[j], f) == EOF) + { + free(mb); return -1; + } done++; } } while (len < field_width--) { if (putc(' ', f) == EOF) + { + free(mb); return -1; + } done++; } + free(mb); return done; } _____ Modified: trunk/reactos/lib/crt/stdio/vfwprint.c --- trunk/reactos/lib/crt/stdio/vfwprint.c 2005-11-24 01:49:36 UTC (rev 19514) +++ trunk/reactos/lib/crt/stdio/vfwprint.c 2005-11-24 06:07:04 UTC (rev 19515) @@ -7,7 +7,7 @@ #include <malloc.h> #include <internal/file.h> -#include <ntdef.h> +#include <winnt.h> int _isnanl(double x); int _isinfl(double x); _____ Modified: trunk/reactos/lib/crt/stdlib/senv.c --- trunk/reactos/lib/crt/stdlib/senv.c 2005-11-24 01:49:36 UTC (rev 19514) +++ trunk/reactos/lib/crt/stdlib/senv.c 2005-11-24 06:07:04 UTC (rev 19515) @@ -17,7 +17,7 @@ _TCHAR* y; _TCHAR* FilePart; - DPRINT(#_tsearchenv"()\n"); + DPRINT(MK_STR(_tsearchenv)"()\n"); x = _tcschr(env,'='); if ( x != NULL ) { _____ Modified: trunk/reactos/lib/crt/stdlib/strtoull.c --- trunk/reactos/lib/crt/stdlib/strtoull.c 2005-11-24 01:49:36 UTC (rev 19514) +++ trunk/reactos/lib/crt/stdlib/strtoull.c 2005-11-24 06:07:04 UTC (rev 19515) @@ -8,19 +8,23 @@ #include <stdlib.h> #include <internal/file.h> +#if defined (_MSC_VER) +#define UINT64_MAX 0xffffffffffffffff +#endif + /* * Convert a string to an unsigned long integer. * * Ignores `locale' stuff. Assumes that the upper and lower case * alphabets and digits are each contiguous. */ -uint64_t +UINT64 strtoull(const char *nptr, char **endptr, int base) { const char *s = nptr; - uint64_t acc; + UINT64 acc; int c; - uint64_t cutoff; + UINT64 cutoff; int neg = 0, any, cutlim; /* _____ Modified: trunk/reactos/lib/crt/sys_stat/fstat.c --- trunk/reactos/lib/crt/sys_stat/fstat.c 2005-11-24 01:49:36 UTC (rev 19514) +++ trunk/reactos/lib/crt/sys_stat/fstat.c 2005-11-24 06:07:04 UTC (rev 19515) @@ -73,7 +73,7 @@ else if (dwFileType == FILE_TYPE_PIPE) { statbuf->st_dev = fd; - statbuf->st_mode = S_IFIFO; + statbuf->st_mode = -1; //S_IFIFO; } else { _____ Modified: trunk/reactos/lib/crt/time/difftime.c --- trunk/reactos/lib/crt/time/difftime.c 2005-11-24 01:49:36 UTC (rev 19514) +++ trunk/reactos/lib/crt/time/difftime.c 2005-11-24 06:07:04 UTC (rev 19515) @@ -1,4 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ +#include "precomp.h" #include <time.h> /*
19 years, 1 month
1
0
0
0
[jimtabor] 19514: set eol-style to native
by jimtabor@svn.reactos.com
set eol-style to native Modified: trunk/reactos/drivers/dd/portcls/portcls.def Property changes on: trunk/reactos/drivers/dd/portcls/portcls.c ___________________________________________________________________ Name: svn:eol-style + native _____ Modified: trunk/reactos/drivers/dd/portcls/portcls.def --- trunk/reactos/drivers/dd/portcls/portcls.def 2005-11-24 01:09:01 UTC (rev 19513) +++ trunk/reactos/drivers/dd/portcls/portcls.def 2005-11-24 01:49:36 UTC (rev 19514) @@ -1,7 +1,7 @@ -; -; Exports definition file for portcls.sys -; -EXPORTS +; +; Exports definition file for portcls.sys +; +EXPORTS PcAddAdapterDevice@20 PcAddContentHandlers@12 PcCompleteIrp@12 Property changes on: trunk/reactos/drivers/dd/portcls/portcls.def ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/reactos/drivers/dd/portcls/portcls.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/reactos/drivers/dd/portcls/portcls.rc ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/reactos/drivers/dd/portcls/portcls.xml ___________________________________________________________________ Name: svn:eol-style + native
19 years, 1 month
1
0
0
0
[jimtabor] 19513: Sorry for the mess. 8^P
by jimtabor@svn.reactos.com
Sorry for the mess. 8^P Deleted: trunk/reactos/drivers/dd/portcls.c Deleted: trunk/reactos/drivers/dd/portcls.def Deleted: trunk/reactos/drivers/dd/portcls.h Deleted: trunk/reactos/drivers/dd/portcls.rc Deleted: trunk/reactos/drivers/dd/portcls.xml _____ Deleted: trunk/reactos/drivers/dd/portcls.c --- trunk/reactos/drivers/dd/portcls.c 2005-11-24 01:05:58 UTC (rev 19512) +++ trunk/reactos/drivers/dd/portcls.c 2005-11-24 01:09:01 UTC (rev 19513) @@ -1,505 +0,0 @@ -/* - * ReactOS PortCls Driver - * Copyright (C) 2005 ReactOS Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS Sound System - * PURPOSE: Audio Port Class Functions - * FILE: drivers/dd/sound/portcls/portcls.c - * PROGRAMMERS: - * - * REVISION HISTORY: - * 21 November 2005 Created James Tabor - */ -#include <windows.h> -#include "portcls.h" - - -#define NDEBUG -#include <debug.h> - - -NTSTATUS STDCALL -DriverEntry(PDRIVER_OBJECT DriverObject, - PUNICODE_STRING RegistryPath) -{ - return STATUS_SUCCESS; -} - -/* - * @implemented - */ -DWORD STDCALL -DllInitialize(DWORD Unknown) -{ - return 0; -} - -/* - * @implemented - */ -DWORD STDCALL -DllUnload(VOID) -{ - return 0; -} - - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcAddAdapterDevice( - DWORD DriverObject, - DWORD PhysicalDeviceObject, - DWORD StartDevice, - DWORD MaxObjects, - DWORD DeviceExtensionSize -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcAddContentHandlers( - DWORD ContentId, - DWORD paHandlers, - DWORD NumHandlers -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcCompleteIrp( - DWORD DeviceObject, - DWORD Irp, - DWORD Status -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcCompletePendingPropertyRequest( - DWORD PropertyRequest, - DWORD NtStatus -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcCreateContentMixed( - DWORD paContentId, - DWORD cContentId, - DWORD pMixedContentId -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcDestroyContent( - DWORD ContentId -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcDispatchIrp( - DWORD DeviceObject, - DWORD Irp -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcForwardContentToDeviceObject( - DWORD ContentId, - DWORD Reserved, - DWORD DrmForward -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcForwardContentToFileObject( - DWORD ContentId, - DWORD FileObject -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcForwardContentToInterface( - DWORD ContentId, - DWORD Unknown, - DWORD NumMethods -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcForwardIrpSynchronous( - DWORD DeviceObject, - DWORD Irp -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcGetContentRights( - DWORD ContentId, - DWORD DrmRights -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcGetDeviceProperty( - DWORD DeviceObject, - DWORD DeviceProperty, - DWORD BufferLength, - DWORD PropertyBuffer, - DWORD ResultLength -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -ULONGLONG STDCALL -PcGetTimeInterval( - ULONGLONG Timei -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcInitializeAdapterDriver( - DWORD DriverObject, - DWORD RegistryPathName, - DWORD AddDevice -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcNewDmaChannel( - DWORD OutDmaChannel, - DWORD Unknown, - DWORD PoolType, - DWORD DeviceDescription, - DWORD DeviceObject -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcNewInterruptSync( - DWORD OutInterruptSync, - DWORD Unknown, - DWORD ResourceList, - DWORD ResourceIndex, - DWORD Mode -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcNewMiniport( - DWORD OutMiniport, - DWORD ClassId -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcNewPort( - DWORD OutPort, - DWORD ClassId -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcNewRegistryKey( - DWORD OutRegistryKey, - DWORD Unknown, - DWORD RegistryKeyType, - DWORD DesiredAccess, - DWORD DeviceObject, - DWORD SubDevice, - DWORD ObjectAttributes, - DWORD CreateOptions, - DWORD Disposition -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcNewResourceList( - DWORD OutResourceList, - DWORD Unknown, - DWORD PoolType, - DWORD TranslatedResources, - DWORD UntranslatedResources -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcNewResourceSublist( - DWORD OutResourceList, - DWORD Unknown, - DWORD PoolType, - DWORD ParentList, - DWORD MaximumEntries -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcNewServiceGroup( - DWORD OutServiceGroup, - DWORD Unknown -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcRegisterAdapterPowerManagement( - DWORD Unknown, - DWORD pvContext -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcRegisterIoTimeout( - DWORD pDeviceObject, - DWORD pTimerRoutine, - DWORD pContext -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcRegisterPhysicalConnection( - DWORD DeviceObject, - DWORD FromUnknown, - DWORD FromPin, - DWORD ToUnknown, - DWORD ToPin -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcRegisterPhysicalConnectionFromExternal( - DWORD DeviceObject, - DWORD FromString, - DWORD FromPin, - DWORD ToUnknown, - DWORD ToPin -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcRegisterPhysicalConnectionToExternal( - DWORD DeviceObject, - DWORD FromUnknown, - DWORD FromPin, - DWORD ToString, - DWORD ToPin -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcRegisterSubdevice( - DWORD DeviceObject, - DWORD SubdevName, - DWORD Unknown -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcRequestNewPowerState( - DWORD pDeviceObject, - DWORD RequestedNewState -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - -/* - * @unimplemented - */ -NTSTATUS STDCALL -PcUnregisterIoTimeout( - DWORD pDeviceObject, - DWORD pTimerRoutine, - DWORD pContext -) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - _____ Deleted: trunk/reactos/drivers/dd/portcls.def --- trunk/reactos/drivers/dd/portcls.def 2005-11-24 01:05:58 UTC (rev 19512) +++ trunk/reactos/drivers/dd/portcls.def 2005-11-24 01:09:01 UTC (rev 19513) @@ -1,36 +0,0 @@ -; -; Exports definition file for portcls.sys -; -EXPORTS -PcAddAdapterDevice@20 -PcAddContentHandlers@12 -PcCompleteIrp@12 -PcCompletePendingPropertyRequest@8 -PcCreateContentMixed@12 -PcDestroyContent@4 -PcDispatchIrp@8 -PcForwardContentToDeviceObject@12 -PcForwardContentToFileObject@8 -PcForwardContentToInterface@12 -PcForwardIrpSynchronous@8 -PcGetContentRights@8 -PcGetDeviceProperty@20 -PcGetTimeInterval@8 -PcInitializeAdapterDriver@12 -PcNewDmaChannel@20 -PcNewInterruptSync@20 -PcNewMiniport@8 -PcNewPort@8 -PcNewRegistryKey@36 -PcNewResourceList@20 -PcNewResourceSublist@20 -PcNewServiceGroup@8 -PcRegisterAdapterPowerManagement@8 -PcRegisterIoTimeout@12 -PcRegisterPhysicalConnection@20 -PcRegisterPhysicalConnectionFromExternal@20 -PcRegisterPhysicalConnectionToExternal@20 -PcRegisterSubdevice@12 -PcRequestNewPowerState@8 -PcUnregisterIoTimeout@12 - _____ Deleted: trunk/reactos/drivers/dd/portcls.h --- trunk/reactos/drivers/dd/portcls.h 2005-11-24 01:05:58 UTC (rev 19512) +++ trunk/reactos/drivers/dd/portcls.h 2005-11-24 01:09:01 UTC (rev 19513) @@ -1,252 +0,0 @@ -/* - - Move to w32api when it is ready. - - */ -#ifndef _PORTCLS_H -#define _PORTCLS_H -#if __GNUC__ >=3 -#pragma GCC system_header -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#include <windef.h> -#include <ddk/ntddk.h> - -#define PORTCLASSAPI extern - -PORTCLASSAPI NTSTATUS STDCALL -PcAddAdapterDevice( - DWORD DriverObject, - DWORD PhysicalDeviceObject, - DWORD StartDevice, - DWORD MaxObjects, - DWORD DeviceExtensionSize -); - -PORTCLASSAPI NTSTATUS STDCALL -PcAddContentHandlers( - DWORD ContentId, - DWORD paHandlers, - DWORD NumHandlers -); - -PORTCLASSAPI NTSTATUS STDCALL -PcCompleteIrp( - DWORD DeviceObject, - DWORD Irp, - DWORD Status -); - -PORTCLASSAPI NTSTATUS STDCALL -PcCompletePendingPropertyRequest( - DWORD PropertyRequest, - DWORD NtStatus -); - -PORTCLASSAPI NTSTATUS STDCALL -PcCreateContentMixed( - DWORD paContentId, - DWORD cContentId, - DWORD pMixedContentId -); - -PORTCLASSAPI NTSTATUS STDCALL -PcDestroyContent( - DWORD ContentId -); - -PORTCLASSAPI NTSTATUS STDCALL -PcDispatchIrp( - DWORD DeviceObject, - DWORD Irp -); - -PORTCLASSAPI NTSTATUS STDCALL -PcForwardContentToDeviceObject( - DWORD ContentId, - DWORD Reserved, - DWORD DrmForward -); - -PORTCLASSAPI NTSTATUS STDCALL -PcForwardContentToFileObject( - DWORD ContentId, - DWORD FileObject -); - -PORTCLASSAPI NTSTATUS STDCALL -PcForwardContentToInterface( - DWORD ContentId, - DWORD Unknown, - DWORD NumMethods -); - -PORTCLASSAPI NTSTATUS STDCALL -PcForwardIrpSynchronous( - DWORD DeviceObject, - DWORD Irp -); - -PORTCLASSAPI NTSTATUS STDCALL -PcGetContentRights( - DWORD ContentId, - DWORD DrmRights -); - -PORTCLASSAPI NTSTATUS STDCALL -PcGetDeviceProperty( - DWORD DeviceObject, - DWORD DeviceProperty, - DWORD BufferLength, - DWORD PropertyBuffer, - DWORD ResultLength -); - -PORTCLASSAPI ULONGLONG STDCALL -PcGetTimeInterval( - ULONGLONG Timei -); - -PORTCLASSAPI NTSTATUS STDCALL -PcInitializeAdapterDriver( - DWORD DriverObject, - DWORD RegistryPathName, - DWORD AddDevice -); - -PORTCLASSAPI NTSTATUS STDCALL -PcNewDmaChannel( - DWORD OutDmaChannel, - DWORD Unknown, - DWORD PoolType, - DWORD DeviceDescription, - DWORD DeviceObject -); - -PORTCLASSAPI NTSTATUS STDCALL -PcNewInterruptSync( - DWORD OutInterruptSync, - DWORD Unknown, - DWORD ResourceList, - DWORD ResourceIndex, - DWORD Mode -); - -PORTCLASSAPI NTSTATUS STDCALL -PcNewMiniport( - DWORD OutMiniport, - DWORD ClassId -); - -PORTCLASSAPI NTSTATUS STDCALL -PcNewPort( - DWORD OutPort, - DWORD ClassId -); - -PORTCLASSAPI NTSTATUS STDCALL -PcNewRegistryKey( - DWORD OutRegistryKey, - DWORD Unknown, - DWORD RegistryKeyType, - DWORD DesiredAccess, - DWORD DeviceObject, - DWORD SubDevice, - DWORD ObjectAttributes, - DWORD CreateOptions, - DWORD Disposition -); - -PORTCLASSAPI NTSTATUS STDCALL -PcNewResourceList( - DWORD OutResourceList, - DWORD Unknown, - DWORD PoolType, - DWORD TranslatedResources, - DWORD UntranslatedResources -); - -PORTCLASSAPI NTSTATUS STDCALL -PcNewResourceSublist( - DWORD OutResourceList, - DWORD Unknown, - DWORD PoolType, - DWORD ParentList, - DWORD MaximumEntries -); - -PORTCLASSAPI NTSTATUS STDCALL -PcNewServiceGroup( - DWORD OutServiceGroup, - DWORD Unknown -); - -PORTCLASSAPI NTSTATUS STDCALL -PcRegisterAdapterPowerManagement( - DWORD Unknown, - DWORD pvContext -); - -PORTCLASSAPI NTSTATUS STDCALL -PcRegisterIoTimeout( - DWORD pDeviceObject, - DWORD pTimerRoutine, - DWORD pContext -); - -PORTCLASSAPI NTSTATUS STDCALL -PcRegisterPhysicalConnection( - DWORD DeviceObject, - DWORD FromUnknown, - DWORD FromPin, - DWORD ToUnknown, - DWORD ToPin -); - -PORTCLASSAPI NTSTATUS STDCALL -PcRegisterPhysicalConnectionFromExternal( - DWORD DeviceObject, - DWORD FromString, - DWORD FromPin, - DWORD ToUnknown, - DWORD ToPin -); - -PORTCLASSAPI NTSTATUS STDCALL -PcRegisterPhysicalConnectionToExternal( - DWORD DeviceObject, - DWORD FromUnknown, - DWORD FromPin, - DWORD ToString, - DWORD ToPin -); - -PORTCLASSAPI NTSTATUS STDCALL -PcRegisterSubdevice( - DWORD DeviceObject, - DWORD SubdevName, - DWORD Unknown -); - -PORTCLASSAPI NTSTATUS STDCALL -PcRequestNewPowerState( - DWORD pDeviceObject, - DWORD RequestedNewState -); - -PORTCLASSAPI NTSTATUS STDCALL -PcUnregisterIoTimeout( - DWORD pDeviceObject, - DWORD pTimerRoutine, - DWORD pContext -); - -#ifdef __cplusplus -} -#endif - -#endif _____ Deleted: trunk/reactos/drivers/dd/portcls.rc --- trunk/reactos/drivers/dd/portcls.rc 2005-11-24 01:05:58 UTC (rev 19512) +++ trunk/reactos/drivers/dd/portcls.rc 2005-11-24 01:09:01 UTC (rev 19513) @@ -1,5 +0,0 @@ -#define REACTOS_VERSION_DLL -#define REACTOS_STR_FILE_DESCRIPTION "PORTCLS Port Class Driver API\0" -#define REACTOS_STR_INTERNAL_NAME "portcls\0" -#define REACTOS_STR_ORIGINAL_FILENAME "portcls.sys\0" -#include <reactos/version.rc> _____ Deleted: trunk/reactos/drivers/dd/portcls.xml --- trunk/reactos/drivers/dd/portcls.xml 2005-11-24 01:05:58 UTC (rev 19512) +++ trunk/reactos/drivers/dd/portcls.xml 2005-11-24 01:09:01 UTC (rev 19513) @@ -1,8 +0,0 @@ -<module name="portcls" type="kernelmodedriver" installbase="system32/drivers" installname="portcls.sys"> - <importlibrary definition="portcls.def" /> - <define name="__USE_W32API" /> - <library>ntoskrnl</library> - <library>hal</library> - <file>portcls.c</file> - <file>portcls.rc</file> -</module>
19 years, 1 month
1
0
0
0
← Newer
1
...
25
26
27
28
29
30
31
...
88
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
83
84
85
86
87
88
Results per page:
10
25
50
100
200