31 WCHAR szDosDeviceName[64];
32 DWORD dwIndex, dwType, dwPortNumber;
33 DWORD dwDeviceNameSize, dwDosDeviceNameSize;
41 L"Hardware\\DeviceMap\\PARALLEL PORTS",
47 for (dwIndex = 0; ; dwIndex++)
50 dwDosDeviceNameSize =
sizeof(szDosDeviceName);
58 &dwDosDeviceNameSize);
65 if (
_wcsnicmp(szDosDeviceName,
L"\\DosDevices\\LPT",
wcslen(
L"\\DosDevices\\LPT")) == 0)
67 ptr = szDosDeviceName +
wcslen(
L"\\DosDevices\\LPT");
72 if (dwPortNumber != 0)
74 *pPortMap |=(1 << dwPortNumber);
97 TRACE(
"ReadPortSettings(%p)\n", pPortData);
120 ERR(
"RegQueryValueExW failed (Error %lu)\n", dwError);
125 L"FilterResourceMethod",
132 ERR(
"RegQueryValueExW failed (Error %lu)\n", dwError);
139 L"SYSTEM\\CurrentControlSet\\Services\\Parport\\Parameters",
147 L"ParEnableLegacyZip",
154 ERR(
"RegQueryValueExW failed (Error %lu)\n", dwError);
168 WCHAR szDeviceDescription[256];
169 WCHAR szFriendlyName[256];
170 WCHAR szNewPortName[16];
175 if (pPortData->dwPortNumber == dwNewPortNumber)
179 swprintf(szNewPortName,
L"LPT%lu", dwNewPortNumber);
183 pPortData->DeviceInfoData,
204 wcscpy(pPortData->szPortName, szNewPortName);
205 pPortData->dwPortNumber = dwNewPortNumber;
209 pPortData->DeviceInfoData,
212 (
PBYTE)szDeviceDescription,
213 sizeof(szDeviceDescription),
226 L"Parallel Port (%s)",
232 pPortData->DeviceInfoData,
234 (
PBYTE)szFriendlyName,
253 DWORD dwFilterResourceMethod;
261 TRACE(
"WritePortSettings(%p)\n", pPortData);
263 dwFilterResourceMethod = 1;
265 dwFilterResourceMethod = 0;
267 dwFilterResourceMethod = 1;
269 dwFilterResourceMethod = 2;
282 L"FilterResourceMethod",
285 (
PBYTE)&dwFilterResourceMethod,
286 sizeof(dwFilterResourceMethod));
300 if (dwLegacy != pPortData->
dwLegacy)
303 L"SYSTEM\\CurrentControlSet\\Services\\Parport\\Parameters",
314 L"ParEnableLegacyZip",
330 if (dwPortNumber !=
LB_ERR)
337 if (dwPortMap & 1 << dwPortNumber)
339 ERR(
"Port LPT%lu is already in use!\n", dwPortNumber);
383 WCHAR szPortInUse[64];
389 TRACE(
"OnInitDialog()\n");
392 if (pPortData ==
NULL)
394 ERR(
"pPortData is NULL\n");
425 for (
i = 1;
i < 4;
i++)
430 wcscat(szBuffer, szPortInUse);
457 TRACE(
"OnNotify()\n");
460 if (pPortData ==
NULL)
462 ERR(
"pPortData is NULL\n");
468 TRACE(
"PSN_APPLY!\n");
481 TRACE(
"OnDestroy()\n");
484 if (pPortData ==
NULL)
486 ERR(
"pPortData is NULL\n");
503 TRACE(
"ParallelSettingsDlgProc()\n");
533 TRACE(
"ParallelPortPropPageProvider(%p %p %lx)\n",
534 lpPropSheetPageRequest, lpfnAddPropSheetPageProc,
lParam);
539 if (pPortData ==
NULL)
541 ERR(
"Port data allocation failed!\n");
550 TRACE(
"SPPSR_ENUM_ADV_DEVICE_PROPERTIES\n");
561 if (hPropSheetPage ==
NULL)
563 ERR(
"CreatePropertySheetPageW() failed!\n");
567 if (!(*lpfnAddPropSheetPageProc)(hPropSheetPage,
lParam))
569 ERR(
"lpfnAddPropSheetPageProc() failed!\n");
#define RegCloseKey(hKey)
static const WCHAR szDeviceName[]
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage)
BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
#define INVALID_HANDLE_VALUE
#define HeapFree(x, y, z)
static DWORD ChangePortNumber(_In_ PPORT_DATA pPortData, _In_ DWORD dwNewPortNumber)
static VOID WritePortSettings(HWND hwnd, PPORT_DATA pPortData)
static VOID OnDestroy(HWND hwnd)
BOOL WINAPI ParallelPortPropPageProvider(PSP_PROPSHEETPAGE_REQUEST lpPropSheetPageRequest, LPFNADDPROPSHEETPAGE lpfnAddPropSheetPageProc, LPARAM lParam)
static INT_PTR CALLBACK ParallelSettingsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
struct _PORT_DATA PORT_DATA
static VOID GetUsedPorts(PDWORD pPortMap)
static VOID OnNotify(HWND hwnd, WPARAM wParam, LPARAM lParam)
struct _PORT_DATA * PPORT_DATA
static BOOL OnInitDialog(HWND hwnd, WPARAM wParam, LPARAM lParam)
static VOID ReadPortSettings(PPORT_DATA pPortData)
#define IDC_NEVER_INTERRUPT
#define IDD_PARALLELSETTINGS
#define IDC_TRY_INTERRUPT
#define IDC_ANY_INTERRUPT
#define IDC_PARALLEL_LEGACY
#define IDC_PARALLEL_NAME
BOOL WINAPI SetupDiCallClassInstaller(DI_FUNCTION InstallFunction, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData)
HKEY WINAPI SetupDiOpenDevRegKey(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, REGSAM samDesired)
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
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
struct _PSP * HPROPSHEETPAGE
#define REG_OPTION_NON_VOLATILE
struct _PROPSHEETPAGEW PROPSHEETPAGEW
BOOL(CALLBACK * LPFNADDPROPSHEETPAGE)(HPROPSHEETPAGE, LPARAM)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_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)
struct _SP_CLASSINSTALL_HEADER SP_CLASSINSTALL_HEADER
#define SetupDiSetClassInstallParams
#define SetupDiGetDeviceRegistryProperty
#define SetupDiSetDeviceRegistryProperty
#define DIF_PROPERTYCHANGE
#define SPDRP_FRIENDLYNAME
#define SPPSR_ENUM_ADV_DEVICE_PROPERTIES
PSP_DEVINFO_DATA DeviceInfoData
DWORD dwFilterResourceMethod
SP_CLASSINSTALL_HEADER ClassInstallHeader
PSP_DEVINFO_DATA DeviceInfoData
DWORD WINAPI GetLastError(void)
#define ComboBox_SetCurSel(hwndCtl, index)
#define ComboBox_GetCurSel(hwndCtl)
#define Button_GetCheck(hwndCtl)
#define ComboBox_AddString(hwndCtl, lpsz)
#define Button_SetCheck(hwndCtl, check)
#define HKEY_LOCAL_MACHINE
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)