ReactOS  0.4.14-dev-376-gaedba84
classinst.c File Reference
#include "precomp.h"
#include <wchar.h>
#include <ndk/cmtypes.h>
Include dependency graph for classinst.c:

Go to the source code of this file.

Macros

#define NTOS_MODE_USER
 

Typedefs

typedef enum _PORT_TYPE PORT_TYPE
 

Enumerations

enum  _PORT_TYPE { UnknownPort, ParallelPort, SerialPort }
 

Functions

BOOL GetBootResourceList (HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PCM_RESOURCE_LIST *ppResourceList)
 
DWORD GetSerialPortNumber (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
 
DWORD GetParallelPortNumber (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
 
static DWORD InstallSerialPort (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
 
static DWORD InstallParallelPort (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
 
VOID InstallDeviceData (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
 
PORT_TYPE GetPortType (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
 
static DWORD InstallPort (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
 
static DWORD RemovePort (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
 
DWORD WINAPI PortsClassInstaller (IN DI_FUNCTION InstallFunction, IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
 

Variables

LPWSTR pszCom = L"COM"
 
LPWSTR pszLpt = L"LPT"
 

Macro Definition Documentation

◆ NTOS_MODE_USER

#define NTOS_MODE_USER

Definition at line 13 of file classinst.c.

Typedef Documentation

◆ PORT_TYPE

Enumeration Type Documentation

◆ _PORT_TYPE

Enumerator
UnknownPort 
ParallelPort 
SerialPort 

Definition at line 16 of file classinst.c.

17 {
21 } PORT_TYPE;
enum _PORT_TYPE PORT_TYPE

Function Documentation

◆ GetBootResourceList()

BOOL GetBootResourceList ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData,
PCM_RESOURCE_LIST ppResourceList 
)

Definition at line 28 of file classinst.c.

31 {
32  WCHAR DeviceInstanceIdBuffer[128];
33  HKEY hEnumKey = NULL;
34  HKEY hDeviceKey = NULL;
35  HKEY hConfigKey = NULL;
37  DWORD dwDataSize;
38  LONG lError;
39  BOOL ret = FALSE;
40 
41  FIXME("GetBootResourceList()\n");
42 
43  *ppResourceList = NULL;
44 
47  DeviceInstanceIdBuffer,
48  ARRAYSIZE(DeviceInstanceIdBuffer),
49  &dwDataSize))
50  {
51  ERR("SetupDiGetDeviceInstanceIdW() failed\n");
52  return FALSE;
53  }
54 
56  L"SYSTEM\\CurrentControlSet\\Enum",
57  0,
59  &hEnumKey);
60  if (lError != ERROR_SUCCESS)
61  {
62  ERR("RegOpenKeyExW() failed (Error %lu)\n", lError);
63  goto done;
64  }
65 
66  lError = RegOpenKeyExW(hEnumKey,
67  DeviceInstanceIdBuffer,
68  0,
70  &hDeviceKey);
71  if (lError != ERROR_SUCCESS)
72  {
73  ERR("RegOpenKeyExW() failed (Error %lu)\n", lError);
74  goto done;
75  }
76 
77  lError = RegOpenKeyExW(hDeviceKey,
78  L"LogConf",
79  0,
81  &hConfigKey);
82  if (lError != ERROR_SUCCESS)
83  {
84  ERR("RegOpenKeyExW() failed (Error %lu)\n", lError);
85  goto done;
86  }
87 
88  /* Get the configuration data size */
89  lError = RegQueryValueExW(hConfigKey,
90  L"BootConfig",
91  NULL,
92  NULL,
93  NULL,
94  &dwDataSize);
95  if (lError != ERROR_SUCCESS)
96  {
97  ERR("RegQueryValueExW() failed (Error %lu)\n", lError);
98  goto done;
99  }
100 
101  /* Allocate the buffer */
102  lpBuffer = HeapAlloc(GetProcessHeap(), 0, dwDataSize);
103  if (lpBuffer == NULL)
104  {
105  ERR("Failed to allocate the resource list buffer\n");
106  goto done;
107  }
108 
109  /* Retrieve the configuration data */
110  lError = RegQueryValueExW(hConfigKey,
111  L"BootConfig",
112  NULL,
113  NULL,
114  (LPBYTE)lpBuffer,
115  &dwDataSize);
116  if (lError == ERROR_SUCCESS)
117  {
118  ERR("RegQueryValueExW() failed (Error %lu)\n", lError);
119  ret = TRUE;
120  }
121 
122 done:
123  if (ret == FALSE && lpBuffer != NULL)
125 
126  if (hConfigKey)
127  RegCloseKey(hConfigKey);
128 
129  if (hDeviceKey)
130  RegCloseKey(hDeviceKey);
131 
132  if (hEnumKey)
134 
135  if (ret != FALSE)
136  *ppResourceList = (PCM_RESOURCE_LIST)lpBuffer;
137 
138  return ret;
139 }
struct _CM_RESOURCE_LIST * PCM_RESOURCE_LIST
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define FIXME(fmt,...)
Definition: debug.h:110
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
HKEY hEnumKey
Definition: umpnpmgr.c:44
int ret
static const WCHAR L[]
Definition: oid.c:1250
#define ERR(fmt,...)
Definition: debug.h:109
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
BOOL WINAPI SetupDiGetDeviceInstanceIdW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PWSTR DeviceInstanceId, DWORD DeviceInstanceIdSize, PDWORD RequiredSize)
Definition: devinst.c:1912
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define HeapFree(x, y, z)
Definition: compat.h:402
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by GetParallelPortNumber(), and GetSerialPortNumber().

◆ GetParallelPortNumber()

DWORD GetParallelPortNumber ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData 
)

Definition at line 215 of file classinst.c.

217 {
218  PCM_RESOURCE_LIST lpResourceList = NULL;
220  ULONG i;
221  DWORD dwBaseAddress = 0;
222  DWORD dwPortNumber = 0;
223 
224  TRACE("GetParallelPortNumber(%p, %p)\n",
226 
229  &lpResourceList))
230  {
231  TRACE("Full resource descriptors: %ul\n", lpResourceList->Count);
232  if (lpResourceList->Count > 0)
233  {
234  TRACE("Partial resource descriptors: %ul\n", lpResourceList->List[0].PartialResourceList.Count);
235 
236  for (i = 0; i < lpResourceList->List[0].PartialResourceList.Count; i++)
237  {
238  lpResDes = &lpResourceList->List[0].PartialResourceList.PartialDescriptors[i];
239  TRACE("Type: %u\n", lpResDes->Type);
240 
241  switch (lpResDes->Type)
242  {
243  case CmResourceTypePort:
244  TRACE("Port: Start: %I64x Length: %lu\n",
245  lpResDes->u.Port.Start.QuadPart,
246  lpResDes->u.Port.Length);
247  if ((lpResDes->u.Port.Start.HighPart == 0) && (dwBaseAddress == 0))
248  dwBaseAddress = (DWORD)lpResDes->u.Port.Start.LowPart;
249  break;
250 
252  TRACE("Interrupt: Level: %lu Vector: %lu\n",
253  lpResDes->u.Interrupt.Level,
254  lpResDes->u.Interrupt.Vector);
255  break;
256  }
257 
258  }
259 
260  }
261 
262  HeapFree(GetProcessHeap(), 0, lpResourceList);
263  }
264 
265  switch (dwBaseAddress)
266  {
267  case 0x378:
268  dwPortNumber = 1;
269  break;
270 
271  case 0x278:
272  dwPortNumber = 2;
273  break;
274  }
275 
276  return dwPortNumber;
277 }
CM_FULL_RESOURCE_DESCRIPTOR List[1]
Definition: hwresource.cpp:165
#define DWORD
Definition: nt_native.h:44
#define CmResourceTypePort
Definition: hwresource.cpp:123
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376 u
CM_PARTIAL_RESOURCE_LIST PartialResourceList
Definition: hwresource.cpp:160
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL GetBootResourceList(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PCM_RESOURCE_LIST *ppResourceList)
Definition: classinst.c:28
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376::@378 Port
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
unsigned int ULONG
Definition: retypes.h:1
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376::@379 Interrupt
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by InstallParallelPort().

◆ GetPortType()

PORT_TYPE GetPortType ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData 
)

Definition at line 658 of file classinst.c.

660 {
661  HKEY hKey = NULL;
662  DWORD dwSize;
663  DWORD dwType = 0;
664  BYTE bData = 0;
665  PORT_TYPE PortType = UnknownPort;
666  LONG lError;
667 
668  TRACE("GetPortType()\n");
669 
673  0,
674  DIREG_DRV,
675  NULL,
676  NULL);
677  if (hKey == NULL)
678  {
679  goto done;
680  }
681 
682  dwSize = sizeof(BYTE);
683  lError = RegQueryValueExW(hKey,
684  L"PortSubClass",
685  NULL,
686  &dwType,
687  &bData,
688  &dwSize);
689 
690  TRACE("lError: %ld\n", lError);
691  TRACE("dwSize: %lu\n", dwSize);
692  TRACE("dwType: %lu\n", dwType);
693 
694  if (lError == ERROR_SUCCESS &&
695  dwSize == sizeof(BYTE) &&
696  dwType == REG_BINARY)
697  {
698  if (bData == 0)
699  PortType = ParallelPort;
700  else
701  PortType = SerialPort;
702  }
703 
704 done:
705  if (hKey != NULL)
706  RegCloseKey(hKey);
707 
708  TRACE("GetPortType() returns %u \n", PortType);
709 
710  return PortType;
711 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define REG_BINARY
Definition: nt_native.h:1496
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
HKEY WINAPI SetupDiCreateDevRegKeyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, HINF InfHandle, PCWSTR InfSectionName)
Definition: devinst.c:1405
enum _PORT_TYPE PORT_TYPE
#define TRACE(s)
Definition: solgame.cpp:4
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
unsigned char BYTE
Definition: mem.h:68
#define DICS_FLAG_GLOBAL
Definition: setupapi.h:113
#define DIREG_DRV
Definition: setupapi.h:182
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by InstallPort(), and RemovePort().

◆ GetSerialPortNumber()

DWORD GetSerialPortNumber ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData 
)

Definition at line 143 of file classinst.c.

145 {
146  PCM_RESOURCE_LIST lpResourceList = NULL;
148  ULONG i;
149  DWORD dwBaseAddress = 0;
150  DWORD dwPortNumber = 0;
151 
152  TRACE("GetSerialPortNumber(%p, %p)\n",
154 
157  &lpResourceList))
158  {
159  TRACE("Full resource descriptors: %ul\n", lpResourceList->Count);
160  if (lpResourceList->Count > 0)
161  {
162  TRACE("Partial resource descriptors: %ul\n", lpResourceList->List[0].PartialResourceList.Count);
163 
164  for (i = 0; i < lpResourceList->List[0].PartialResourceList.Count; i++)
165  {
166  lpResDes = &lpResourceList->List[0].PartialResourceList.PartialDescriptors[i];
167  TRACE("Type: %u\n", lpResDes->Type);
168 
169  switch (lpResDes->Type)
170  {
171  case CmResourceTypePort:
172  TRACE("Port: Start: %I64x Length: %lu\n",
173  lpResDes->u.Port.Start.QuadPart,
174  lpResDes->u.Port.Length);
175  if ((lpResDes->u.Port.Start.HighPart == 0) && (dwBaseAddress == 0))
176  dwBaseAddress = (DWORD)lpResDes->u.Port.Start.LowPart;
177  break;
178 
180  TRACE("Interrupt: Level: %lu Vector: %lu\n",
181  lpResDes->u.Interrupt.Level,
182  lpResDes->u.Interrupt.Vector);
183  break;
184  }
185  }
186  }
187 
188  HeapFree(GetProcessHeap(), 0, lpResourceList);
189  }
190 
191  switch (dwBaseAddress)
192  {
193  case 0x3f8:
194  dwPortNumber = 1;
195  break;
196 
197  case 0x2f8:
198  dwPortNumber = 2;
199  break;
200 
201  case 0x3e8:
202  dwPortNumber = 3;
203  break;
204 
205  case 0x2e8:
206  dwPortNumber = 4;
207  break;
208  }
209 
210  return dwPortNumber;
211 }
CM_FULL_RESOURCE_DESCRIPTOR List[1]
Definition: hwresource.cpp:165
#define DWORD
Definition: nt_native.h:44
#define CmResourceTypePort
Definition: hwresource.cpp:123
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376 u
CM_PARTIAL_RESOURCE_LIST PartialResourceList
Definition: hwresource.cpp:160
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL GetBootResourceList(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PCM_RESOURCE_LIST *ppResourceList)
Definition: classinst.c:28
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376::@378 Port
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
unsigned int ULONG
Definition: retypes.h:1
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376::@379 Interrupt
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by InstallSerialPort().

◆ InstallDeviceData()

VOID InstallDeviceData ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData  OPTIONAL 
)

Definition at line 568 of file classinst.c.

570 {
571  HKEY hKey = NULL;
572  HINF hInf = INVALID_HANDLE_VALUE;
573  SP_DRVINFO_DATA DriverInfoData;
574  PSP_DRVINFO_DETAIL_DATA DriverInfoDetailData;
575  WCHAR InfSectionWithExt[256];
576  BYTE buffer[2048];
577  DWORD dwRequired;
578 
579  TRACE("InstallDeviceData()\n");
580 
584  0,
585  DIREG_DRV,
586  NULL,
587  NULL);
588  if (hKey == NULL)
589  goto done;
590 
591  DriverInfoData.cbSize = sizeof(SP_DRVINFO_DATA);
594  &DriverInfoData))
595  {
596  goto done;
597  }
598 
599  DriverInfoDetailData = (PSP_DRVINFO_DETAIL_DATA)buffer;
600  DriverInfoDetailData->cbSize = sizeof(SP_DRVINFO_DETAIL_DATA);
603  &DriverInfoData,
604  DriverInfoDetailData,
605  2048,
606  &dwRequired))
607  {
609  goto done;
610  }
611 
612  TRACE("Inf file name: %S\n", DriverInfoDetailData->InfFileName);
613 
614  hInf = SetupOpenInfFileW(DriverInfoDetailData->InfFileName,
615  NULL,
617  NULL);
618  if (hInf == INVALID_HANDLE_VALUE)
619  goto done;
620 
621  TRACE("Section name: %S\n", DriverInfoDetailData->SectionName);
622 
624  DriverInfoDetailData->SectionName,
625  InfSectionWithExt,
626  256,
627  NULL,
628  NULL))
629  goto done;
630 
631  TRACE("InfSectionWithExt: %S\n", InfSectionWithExt);
632 
634  hInf,
635  InfSectionWithExt,
637  hKey,
638  NULL,
639  0,
640  NULL,
641  NULL,
642  NULL,
643  NULL);
644 
645  TRACE("Done\n");
646 
647 done:
648  if (hKey != NULL)
649  RegCloseKey(hKey);
650 
651  if (hInf != INVALID_HANDLE_VALUE)
652  SetupCloseInfFile(hInf);
653 }
SP_DRVINFO_DETAIL_DATA_A * PSP_DRVINFO_DETAIL_DATA
Definition: setupapi.h:1157
BOOL WINAPI SetupDiGetActualSectionToInstallW(HINF InfHandle, PCWSTR InfSectionName, PWSTR InfSectionWithExt, DWORD InfSectionWithExtSize, PDWORD RequiredSize, PWSTR *Extension)
Definition: devinst.c:1985
#define INF_STYLE_WIN4
Definition: infsupp.h:41
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
HINF WINAPI SetupOpenInfFileW(PCWSTR name, PCWSTR class, DWORD style, UINT *error)
Definition: parser.c:1229
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:43
CHAR SectionName[LINE_LEN]
Definition: setupapi.h:1060
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
SP_DRVINFO_DETAIL_DATA_A SP_DRVINFO_DETAIL_DATA
Definition: setupapi.h:1157
#define SPINST_REGISTRY
Definition: setupapi.h:585
smooth NULL
Definition: ftsmooth.c:416
HKEY WINAPI SetupDiCreateDevRegKeyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, HINF InfHandle, PCWSTR InfSectionName)
Definition: devinst.c:1405
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
SP_DRVINFO_DATA_V2 SP_DRVINFO_DATA
Definition: setupapi.h:1049
BOOL WINAPI SetupInstallFromInfSectionW(HWND owner, HINF hinf, PCWSTR section, UINT flags, HKEY key_root, PCWSTR src_root, UINT copy_flags, PSP_FILE_CALLBACK_W callback, PVOID context, HDEVINFO devinfo, PSP_DEVINFO_DATA devinfo_data)
Definition: install.c:1324
unsigned char BYTE
Definition: mem.h:68
#define DICS_FLAG_GLOBAL
Definition: setupapi.h:113
BOOL WINAPI SetupDiGetSelectedDriverW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, OUT PSP_DRVINFO_DATA_W DriverInfoData)
Definition: driver.c:1479
#define DIREG_DRV
Definition: setupapi.h:182
CHAR InfFileName[MAX_PATH]
Definition: setupapi.h:1061
BOOL WINAPI SetupDiGetDriverInfoDetailW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN PSP_DRVINFO_DATA_W DriverInfoData, IN OUT PSP_DRVINFO_DETAIL_DATA_W DriverInfoDetailData OPTIONAL, IN DWORD DriverInfoDetailDataSize, OUT PDWORD RequiredSize OPTIONAL)
Definition: driver.c:1878
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by InstallPort().

◆ InstallParallelPort()

static DWORD InstallParallelPort ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData 
)
static

Definition at line 417 of file classinst.c.

419 {
420  WCHAR szDeviceDescription[256];
421  WCHAR szFriendlyName[256];
422  WCHAR szPortName[8];
423  DWORD dwPortNumber = 0;
424  DWORD dwSize;
425  DWORD dwValue;
426  LONG lError;
427  HKEY hKey;
428 
429  TRACE("InstallParallelPort(%p, %p)\n",
431 
432  /* Try to read the 'PortName' value and determine the port number */
436  0,
437  DIREG_DEV,
438  NULL,
439  NULL);
440  if (hKey != INVALID_HANDLE_VALUE)
441  {
442  dwSize = sizeof(szPortName);
443  lError = RegQueryValueEx(hKey,
444  L"PortName",
445  NULL,
446  NULL,
447  (PBYTE)szPortName,
448  &dwSize);
449  if (lError == ERROR_SUCCESS)
450  {
451  if (_wcsnicmp(szPortName, pszLpt, wcslen(pszLpt)) == 0)
452  {
453  dwPortNumber = _wtoi(szPortName + wcslen(pszLpt));
454  TRACE("LPT port number found: %lu\n", dwPortNumber);
455  }
456  }
457 
458  RegCloseKey(hKey);
459  }
460 
461  /* ... try to determine the port number from its resources */
462  if (dwPortNumber == 0)
463  {
464  dwPortNumber = GetParallelPortNumber(DeviceInfoSet,
466  TRACE("GetParallelPortNumber() returned port number: %lu\n", dwPortNumber);
467  }
468 
469  if (dwPortNumber == 0)
470  {
471  /* FIXME */
472  FIXME("Got no valid port numer!\n");
473  }
474 
475  if (dwPortNumber != 0)
476  {
477  swprintf(szPortName, L"%s%u", pszLpt, dwPortNumber);
478  }
479  else
480  {
481  wcscpy(szPortName, L"LPTx");
482  }
483 
484  if (dwPortNumber != 0)
485  {
486  /* Set the 'PortName' value */
490  0,
491  DIREG_DEV,
492  NULL,
493  NULL);
494  if (hKey != INVALID_HANDLE_VALUE)
495  {
496  RegSetValueExW(hKey,
497  L"PortName",
498  0,
499  REG_SZ,
500  (LPBYTE)szPortName,
501  (wcslen(szPortName) + 1) * sizeof(WCHAR));
502 
503  /*
504  * FIXME / HACK:
505  * This is to get the w2k3 parport.sys to work until we have our own.
506  * This setting makes the driver accept resources with an IRQ instead
507  * of only resources without an IRQ.
508  *
509  * We should probably also fix IO manager to actually give devices a
510  * chance to register without an IRQ. CORE-9645
511  */
512  dwValue = 0;
513  RegSetValueExW(hKey,
514  L"FilterResourceMethod",
515  0,
516  REG_DWORD,
517  (LPBYTE)&dwValue,
518  sizeof(dwValue));
519 
520  RegCloseKey(hKey);
521  }
522  }
523 
524  /* Install the device */
527  {
528  return GetLastError();
529  }
530 
531  /* Get the device description... */
535  NULL,
536  (LPBYTE)szDeviceDescription,
537  256 * sizeof(WCHAR),
538  NULL))
539  {
540  /* ... and use it to build a new friendly name */
541  swprintf(szFriendlyName,
542  L"%s (%s)",
543  szDeviceDescription,
544  szPortName);
545  }
546  else
547  {
548  /* ... or build a generic friendly name */
549  swprintf(szFriendlyName,
550  L"Parallel Port (%s)",
551  szPortName);
552  }
553 
554  TRACE("Friendly name: %S\n", szFriendlyName);
555 
556  /* Set the friendly name for the device */
560  (LPBYTE)szFriendlyName,
561  (wcslen(szFriendlyName) + 1) * sizeof(WCHAR));
562 
563  return ERROR_SUCCESS;
564 }
#define RegQueryValueEx
Definition: winreg.h:524
#define ERROR_SUCCESS
Definition: deptool.c:10
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
BOOL WINAPI SetupDiGetDeviceRegistryPropertyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, PDWORD PropertyRegDataType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize)
Definition: devinst.c:3229
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
BOOL WINAPI SetupDiInstallDevice(IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:5354
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
LPWSTR pszLpt
Definition: classinst.c:24
HKEY WINAPI SetupDiCreateDevRegKeyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, HINF InfHandle, PCWSTR InfSectionName)
Definition: devinst.c:1405
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define DIREG_DEV
Definition: setupapi.h:181
#define swprintf(buf, format,...)
Definition: sprintf.c:56
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
#define SPDRP_FRIENDLYNAME
Definition: setupapi.h:514
unsigned long DWORD
Definition: ntddk_ex.h:95
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
DWORD GetParallelPortNumber(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: classinst.c:215
#define SPDRP_DEVICEDESC
Definition: setupapi.h:502
#define DICS_FLAG_GLOBAL
Definition: setupapi.h:113
BOOL WINAPI SetupDiSetDeviceRegistryPropertyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, const BYTE *PropertyBuffer, DWORD PropertyBufferSize)
Definition: devinst.c:3457
#define REG_DWORD
Definition: sdbapi.c:596
BYTE * PBYTE
Definition: pedump.c:66
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define REG_SZ
Definition: layer.c:22

Referenced by InstallPort().

◆ InstallPort()

static DWORD InstallPort ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData 
)
static

Definition at line 715 of file classinst.c.

717 {
718  PORT_TYPE PortType;
719 
721 
723  switch (PortType)
724  {
725  case ParallelPort:
727 
728  case SerialPort:
730 
731  default:
732  return ERROR_DI_DO_DEFAULT;
733  }
734 }
static DWORD InstallParallelPort(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: classinst.c:417
static DWORD InstallSerialPort(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: classinst.c:281
enum _PORT_TYPE PORT_TYPE
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
VOID InstallDeviceData(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
Definition: classinst.c:568
#define ERROR_DI_DO_DEFAULT
Definition: setupapi.h:305
PORT_TYPE GetPortType(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: classinst.c:658

Referenced by PortsClassInstaller().

◆ InstallSerialPort()

static DWORD InstallSerialPort ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData 
)
static

Definition at line 281 of file classinst.c.

283 {
284  WCHAR szDeviceDescription[256];
285  WCHAR szFriendlyName[256];
286  WCHAR szPortName[8];
287  DWORD dwPortNumber = 0;
288  DWORD dwSize;
289  HCOMDB hComDB = HCOMDB_INVALID_HANDLE_VALUE;
290  HKEY hKey;
291  LONG lError;
292 
293  TRACE("InstallSerialPort(%p, %p)\n",
295 
296  /* Open the com port database */
297  ComDBOpen(&hComDB);
298 
299  /* Try to read the 'PortName' value and determine the port number */
303  0,
304  DIREG_DEV,
305  NULL,
306  NULL);
307  if (hKey != INVALID_HANDLE_VALUE)
308  {
309  dwSize = sizeof(szPortName);
310  lError = RegQueryValueEx(hKey,
311  L"PortName",
312  NULL,
313  NULL,
314  (PBYTE)szPortName,
315  &dwSize);
316  if (lError == ERROR_SUCCESS)
317  {
318  if (_wcsnicmp(szPortName, pszCom, wcslen(pszCom)) == 0)
319  {
320  dwPortNumber = _wtoi(szPortName + wcslen(pszCom));
321  TRACE("COM port number found: %lu\n", dwPortNumber);
322  }
323  }
324 
325  RegCloseKey(hKey);
326  }
327 
328  /* Determine the port number from its resources ... */
329  if (dwPortNumber == 0)
330  dwPortNumber = GetSerialPortNumber(DeviceInfoSet,
332 
333  if (dwPortNumber != 0)
334  {
335  /* ... and claim the port number in the database */
336  ComDBClaimPort(hComDB,
337  dwPortNumber,
338  FALSE,
339  NULL);
340  }
341  else
342  {
343  /* ... or claim the next free port number */
344  ComDBClaimNextFreePort(hComDB,
345  &dwPortNumber);
346  }
347 
348  /* Build the name of the port device */
349  swprintf(szPortName, L"%s%u", pszCom, dwPortNumber);
350 
351  /* Close the com port database */
352  if (hComDB != HCOMDB_INVALID_HANDLE_VALUE)
353  ComDBClose(hComDB);
354 
355  /* Set the 'PortName' value */
359  0,
360  DIREG_DEV,
361  NULL,
362  NULL);
363  if (hKey != INVALID_HANDLE_VALUE)
364  {
365  RegSetValueExW(hKey,
366  L"PortName",
367  0,
368  REG_SZ,
369  (LPBYTE)szPortName,
370  (wcslen(szPortName) + 1) * sizeof(WCHAR));
371 
372  RegCloseKey(hKey);
373  }
374 
375  /* Install the device */
378  {
379  return GetLastError();
380  }
381 
382  /* Get the device description... */
386  NULL,
387  (LPBYTE)szDeviceDescription,
388  256 * sizeof(WCHAR),
389  NULL))
390  {
391  /* ... and use it to build a new friendly name */
392  swprintf(szFriendlyName,
393  L"%s (%s)",
394  szDeviceDescription,
395  szPortName);
396  }
397  else
398  {
399  /* ... or build a generic friendly name */
400  swprintf(szFriendlyName,
401  L"Serial Port (%s)",
402  szPortName);
403  }
404 
405  /* Set the friendly name for the device */
409  (LPBYTE)szFriendlyName,
410  (wcslen(szFriendlyName) + 1) * sizeof(WCHAR));
411 
412  return ERROR_SUCCESS;
413 }
#define RegQueryValueEx
Definition: winreg.h:524
LPWSTR pszCom
Definition: classinst.c:23
#define ERROR_SUCCESS
Definition: deptool.c:10
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
BOOL WINAPI SetupDiGetDeviceRegistryPropertyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, PDWORD PropertyRegDataType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize)
Definition: devinst.c:3229
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
LONG WINAPI ComDBClose(IN HCOMDB hComDB)
Definition: comdb.c:235
#define HCOMDB_INVALID_HANDLE_VALUE
Definition: msports.h:10
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
LONG WINAPI ComDBClaimPort(IN HCOMDB hComDB, IN DWORD ComNumber, IN BOOL ForceClaim, OUT PBOOL Forced)
Definition: comdb.c:123
BOOL WINAPI SetupDiInstallDevice(IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:5354
smooth NULL
Definition: ftsmooth.c:416
DWORD GetSerialPortNumber(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: classinst.c:143
HKEY WINAPI SetupDiCreateDevRegKeyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, HINF InfHandle, PCWSTR InfSectionName)
Definition: devinst.c:1405
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define DIREG_DEV
Definition: setupapi.h:181
#define swprintf(buf, format,...)
Definition: sprintf.c:56
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
#define SPDRP_FRIENDLYNAME
Definition: setupapi.h:514
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
#define SPDRP_DEVICEDESC
Definition: setupapi.h:502
#define DICS_FLAG_GLOBAL
Definition: setupapi.h:113
LONG WINAPI ComDBOpen(OUT HCOMDB *phComDB)
Definition: comdb.c:375
BOOL WINAPI SetupDiSetDeviceRegistryPropertyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, const BYTE *PropertyBuffer, DWORD PropertyBufferSize)
Definition: devinst.c:3457
LONG WINAPI ComDBClaimNextFreePort(IN HCOMDB hComDB, OUT LPDWORD ComNumber)
Definition: comdb.c:24
BYTE * PBYTE
Definition: pedump.c:66
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define REG_SZ
Definition: layer.c:22

Referenced by InstallPort().

◆ PortsClassInstaller()

DWORD WINAPI PortsClassInstaller ( IN DI_FUNCTION  InstallFunction,
IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData  OPTIONAL 
)

Definition at line 803 of file classinst.c.

806 {
807  TRACE("PortsClassInstaller(%lu, %p, %p)\n",
808  InstallFunction, DeviceInfoSet, DeviceInfoData);
809 
810  switch (InstallFunction)
811  {
812  case DIF_INSTALLDEVICE:
814 
815  case DIF_REMOVE:
817 
818  default:
819  TRACE("Install function %u ignored\n", InstallFunction);
820  return ERROR_DI_DO_DEFAULT;
821  }
822 }
static DWORD InstallPort(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: classinst.c:715
#define DIF_INSTALLDEVICE
Definition: setupapi.h:121
#define TRACE(s)
Definition: solgame.cpp:4
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
#define ERROR_DI_DO_DEFAULT
Definition: setupapi.h:305
#define DIF_REMOVE
Definition: setupapi.h:124
static DWORD RemovePort(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: classinst.c:738

◆ RemovePort()

static DWORD RemovePort ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData 
)
static

Definition at line 738 of file classinst.c.

740 {
741  PORT_TYPE PortType;
742  HCOMDB hComDB = HCOMDB_INVALID_HANDLE_VALUE;
743  HKEY hKey;
744  LONG lError;
745  DWORD dwPortNumber;
746  DWORD dwPortNameSize;
747  WCHAR szPortName[8];
748 
749  /* If we are removing a serial port ... */
751  if (PortType == SerialPort)
752  {
753  /* Open the port database */
754  if (ComDBOpen(&hComDB) == ERROR_SUCCESS)
755  {
756  /* Open the device key */
760  0,
761  DIREG_DEV,
762  KEY_READ);
763  if (hKey != INVALID_HANDLE_VALUE)
764  {
765  /* Query the port name */
766  dwPortNameSize = sizeof(szPortName);
767  lError = RegQueryValueEx(hKey,
768  L"PortName",
769  NULL,
770  NULL,
771  (PBYTE)szPortName,
772  &dwPortNameSize);
773 
774  /* Close the device key */
775  RegCloseKey(hKey);
776 
777  /* If we got a valid port name ...*/
778  if (lError == ERROR_SUCCESS)
779  {
780  /* Get the port number */
781  dwPortNumber = _wtoi(szPortName + wcslen(pszCom));
782 
783  /* Release the port */
784  ComDBReleasePort(hComDB, dwPortNumber);
785  }
786  }
787 
788  /* Close the port database */
789  ComDBClose(hComDB);
790  }
791  }
792 
793  /* Remove the device */
795  return GetLastError();
796 
797  return ERROR_SUCCESS;
798 }
#define RegQueryValueEx
Definition: winreg.h:524
LPWSTR pszCom
Definition: classinst.c:23
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
LONG WINAPI ComDBClose(IN HCOMDB hComDB)
Definition: comdb.c:235
#define HCOMDB_INVALID_HANDLE_VALUE
Definition: msports.h:10
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
enum _PORT_TYPE PORT_TYPE
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define DIREG_DEV
Definition: setupapi.h:181
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
HKEY WINAPI SetupDiOpenDevRegKey(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, REGSAM samDesired)
Definition: devinst.c:5919
#define DICS_FLAG_GLOBAL
Definition: setupapi.h:113
BOOL WINAPI SetupDiRemoveDevice(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: stubs.c:64
LONG WINAPI ComDBOpen(OUT HCOMDB *phComDB)
Definition: comdb.c:375
BYTE * PBYTE
Definition: pedump.c:66
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
LONG WINAPI ComDBReleasePort(IN HCOMDB hComDB, IN DWORD ComNumber)
Definition: comdb.c:488
PORT_TYPE GetPortType(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: classinst.c:658

Referenced by DECLARE_INTERFACE_(), and PortsClassInstaller().

Variable Documentation

◆ pszCom

LPWSTR pszCom = L"COM"

Definition at line 23 of file classinst.c.

Referenced by InstallSerialPort(), and RemovePort().

◆ pszLpt

LPWSTR pszLpt = L"LPT"

Definition at line 24 of file classinst.c.

Referenced by InstallParallelPort().