diff --git a/UsbDk/ControlDevice.cpp b/UsbDk/ControlDevice.cpp index b30e836..9151411 100644 --- a/UsbDk/ControlDevice.cpp +++ b/UsbDk/ControlDevice.cpp @@ -107,7 +107,6 @@ void CUsbDkControlDeviceQueue::DeviceControl(WDFQUEUE Queue, } } } -//------------------------------------------------------------------------------------------------------------ void CUsbDkControlDeviceQueue::CountDevices(CWdfRequest &Request, WDFQUEUE Queue) { @@ -123,7 +122,6 @@ void CUsbDkControlDeviceQueue::CountDevices(CWdfRequest &Request, WDFQUEUE Queue Request.SetStatus(status); } -//------------------------------------------------------------------------------------------------------------ void CUsbDkControlDeviceQueue::UpdateRegistryParameters(CWdfRequest &Request, WDFQUEUE Queue) { @@ -158,7 +156,6 @@ void CUsbDkControlDeviceQueue::EnumerateDevices(CWdfRequest &Request, WDFQUEUE Q Request.SetStatus(STATUS_BUFFER_TOO_SMALL); } } -//------------------------------------------------------------------------------------------------------------ template static void CUsbDkControlDeviceQueue::DoUSBDeviceOp(CWdfRequest &Request, @@ -193,7 +190,6 @@ static void CUsbDkControlDeviceQueue::DoUSBDeviceOp(CWdfRequest &Request, Request.SetOutputDataLen(outputLength); Request.SetStatus(status); } -//------------------------------------------------------------------------------------------------------------ void CUsbDkControlDeviceQueue::DoUSBDeviceOp(CWdfRequest &Request, WDFQUEUE Queue, USBDevControlMethod Method) { @@ -212,13 +208,11 @@ void CUsbDkControlDeviceQueue::DoUSBDeviceOp(CWdfRequest &Request, WDFQUEUE Queu Request.SetStatus(status); } -//------------------------------------------------------------------------------------------------------------ void CUsbDkControlDeviceQueue::GetConfigurationDescriptor(CWdfRequest &Request, WDFQUEUE Queue) { DoUSBDeviceOp(Request, Queue, &CUsbDkControlDevice::GetConfigurationDescriptor); } -//------------------------------------------------------------------------------------------------------------ ULONG CUsbDkControlDevice::CountDevices() { @@ -232,7 +226,6 @@ ULONG CUsbDkControlDevice::CountDevices() return numberDevices; } -//------------------------------------------------------------------------------------------------------------ bool CUsbDkControlDevice::ShouldHide(const USB_DEVICE_DESCRIPTOR &DevDescriptor) const { @@ -280,7 +273,6 @@ bool CUsbDkControlDevice::EnumerateDevices(USB_DK_DEVICE_INFO *outBuff, size_t n return true; }); } -//------------------------------------------------------------------------------------------------------------ // EnumUsbDevicesByID runs over the list of USB devices looking for device by ID. // For each device with matching ID Functor() is called. @@ -354,7 +346,6 @@ NTSTATUS CUsbDkControlDevice::GetUsbDeviceConfigurationDescriptor(const USB_DK_D return result ? STATUS_SUCCESS : STATUS_INVALID_DEVICE_REQUEST; } -//------------------------------------------------------------------------------------------------------------ void CUsbDkControlDevice::ContextCleanup(_In_ WDFOBJECT DeviceObject) { @@ -365,7 +356,6 @@ void CUsbDkControlDevice::ContextCleanup(_In_ WDFOBJECT DeviceObject) auto deviceContext = UsbDkControlGetContext(DeviceObject); delete deviceContext->UsbDkControl; } -//------------------------------------------------------------------------------------------------------------ NTSTATUS CUsbDkControlDevice::Create(WDFDRIVER Driver) { @@ -467,7 +457,6 @@ void CUsbDkControlDevice::IoInCallerContext(WDFDEVICE Device, WDFREQUEST Request } } } -//----------------------------------------------------------------------------------------------------- bool CUsbDkControlDevice::FetchBuffersForAddRedirectRequest(CWdfRequest &WdfRequest, PUSB_DK_DEVICE_ID &DeviceId, PULONG64 &RedirectorDevice) { @@ -511,7 +500,6 @@ bool CUsbDkControlDevice::FetchBuffersForAddRedirectRequest(CWdfRequest &WdfRequ return true; } -//----------------------------------------------------------------------------------------------------- CRefCountingHolder *CUsbDkControlDevice::m_UsbDkControlDevice = nullptr; @@ -599,7 +587,6 @@ NTSTATUS CUsbDkControlDevice::GetConfigurationDescriptor(const USB_DK_CONFIG_DES *OutputBuffLen = NT_SUCCESS(status) ? min(Descriptor->wTotalLength, *OutputBuffLen) : 0; return status; } -//------------------------------------------------------------------------------------------------------------- NTSTATUS CUsbDkControlDevice::AddRedirect(const USB_DK_DEVICE_ID &DeviceId, PHANDLE RedirectorDevice) { @@ -855,7 +842,6 @@ NTSTATUS CUsbDkControlDevice::ReloadPersistentHideRules() return status; } -//------------------------------------------------------------------------------------------------------------- NTSTATUS CUsbDkControlDevice::AddDeviceToSet(const USB_DK_DEVICE_ID &DeviceId, CUsbDkRedirection **NewRedirection) { @@ -890,7 +876,6 @@ NTSTATUS CUsbDkControlDevice::AddDeviceToSet(const USB_DK_DEVICE_ID &DeviceId, C return STATUS_SUCCESS; } -//------------------------------------------------------------------------------------------------------------- NTSTATUS CUsbDkControlDevice::RemoveRedirect(const USB_DK_DEVICE_ID &DeviceId) { @@ -926,7 +911,6 @@ NTSTATUS CUsbDkControlDevice::RemoveRedirect(const USB_DK_DEVICE_ID &DeviceId) TraceEvents(TRACE_LEVEL_ERROR, TRACE_CONTROLDEVICE, "%!FUNC! failed."); return STATUS_OBJECT_NAME_NOT_FOUND; } -//------------------------------------------------------------------------------------------------------------- bool CUsbDkControlDevice::NotifyRedirectorAttached(CRegText *DeviceID, CRegText *InstanceID, CUsbDkFilterDevice *RedirectorDevice) { @@ -935,13 +919,11 @@ bool CUsbDkControlDevice::NotifyRedirectorAttached(CRegText *DeviceID, CRegText return m_Redirections.ModifyOne(&ID, [RedirectorDevice](CUsbDkRedirection *R){ R->NotifyRedirectorCreated(RedirectorDevice); }); } -//------------------------------------------------------------------------------------------------------------- bool CUsbDkControlDevice::NotifyRedirectorRemovalStarted(const USB_DK_DEVICE_ID &ID) { return m_Redirections.ModifyOne(&ID, [](CUsbDkRedirection *R){ R->NotifyRedirectionRemovalStarted(); }); } -//------------------------------------------------------------------------------------------------------------- bool CUsbDkControlDevice::WaitForDetachment(const USB_DK_DEVICE_ID &ID) { @@ -959,7 +941,6 @@ bool CUsbDkControlDevice::WaitForDetachment(const USB_DK_DEVICE_ID &ID) return res; } -//------------------------------------------------------------------------------------------------------------- NTSTATUS CUsbDkRedirection::Create(const USB_DK_DEVICE_ID &Id) { diff --git a/UsbDk/FilterStrategy.h b/UsbDk/FilterStrategy.h index a38f622..a6d4ec8 100644 --- a/UsbDk/FilterStrategy.h +++ b/UsbDk/FilterStrategy.h @@ -85,7 +85,6 @@ class CUsbDkFilterStrategy void ForwardRequest(WDFREQUEST Request); TChildrenList m_Children; }; -//----------------------------------------------------------------------------------------- class CUsbDkNullFilterStrategy : public CUsbDkFilterStrategy { @@ -93,7 +92,6 @@ class CUsbDkNullFilterStrategy : public CUsbDkFilterStrategy virtual NTSTATUS MakeAvailable() override { return STATUS_SUCCESS; } }; -//----------------------------------------------------------------------------------------- typedef struct _USBDK_FILTER_REQUEST_CONTEXT { } USBDK_FILTER_REQUEST_CONTEXT, *PUSBDK_FILTER_REQUEST_CONTEXT; diff --git a/UsbDk/HiderDevice.cpp b/UsbDk/HiderDevice.cpp index 62bfbdd..0fa013f 100644 --- a/UsbDk/HiderDevice.cpp +++ b/UsbDk/HiderDevice.cpp @@ -146,7 +146,6 @@ void CUsbDkHiderDeviceQueue::DeviceControl(WDFQUEUE Queue, } -//------------------------------------------------------------------------------------------------------------ void CUsbDkHiderDevice::ContextCleanup(_In_ WDFOBJECT DeviceObject) { @@ -157,7 +156,6 @@ void CUsbDkHiderDevice::ContextCleanup(_In_ WDFOBJECT DeviceObject) auto deviceContext = UsbDkHiderGetContext(DeviceObject); delete deviceContext->UsbDkHider; } -//------------------------------------------------------------------------------------------------------------ NTSTATUS CUsbDkHiderDevice::Create(WDFDRIVER Driver) { @@ -207,4 +205,3 @@ NTSTATUS CUsbDkHiderDevice::Register() return status; } -//----------------------------------------------------------------------------------------------------- diff --git a/UsbDk/Irp.h b/UsbDk/Irp.h index 97e3058..8dd6c6a 100644 --- a/UsbDk/Irp.h +++ b/UsbDk/Irp.h @@ -98,7 +98,6 @@ class CIrp : public CIrpBase void DestroyIrp(); void ReleaseTarget(); }; -//------------------------------------------------------------------------------------------------- class CIoControlIrp : public CIrpBase { @@ -123,4 +122,3 @@ class CIoControlIrp : public CIrpBase CWdmEvent m_Event; IO_STATUS_BLOCK m_IoControlStatus; }; -//------------------------------------------------------------------------------------------------- diff --git a/UsbDk/RedirectorStrategy.cpp b/UsbDk/RedirectorStrategy.cpp index 0100b0a..a532cc0 100644 --- a/UsbDk/RedirectorStrategy.cpp +++ b/UsbDk/RedirectorStrategy.cpp @@ -29,7 +29,6 @@ #include "UsbDkNames.h" #include "ControlDevice.h" #include "WdfRequest.h" -//-------------------------------------------------------------------------------------------------- NTSTATUS CUsbDkRedirectorStrategy::MakeAvailable() { @@ -48,7 +47,6 @@ NTSTATUS CUsbDkRedirectorStrategy::MakeAvailable() return status; } -//-------------------------------------------------------------------------------------------------- NTSTATUS CUsbDkRedirectorStrategy::Create(CUsbDkFilterDevice *Owner) { @@ -86,13 +84,11 @@ NTSTATUS CUsbDkRedirectorStrategy::Create(CUsbDkFilterDevice *Owner) } return status; } -//-------------------------------------------------------------------------------------------------- void CUsbDkRedirectorStrategy::Delete() { CUsbDkFilterStrategy::Delete(); } -//-------------------------------------------------------------------------------------------------- void CUsbDkRedirectorStrategy::PatchDeviceID(PIRP Irp) { @@ -162,7 +158,6 @@ void CUsbDkRedirectorStrategy::PatchDeviceID(PIRP Irp) Irp->IoStatus.Information = reinterpret_cast(Result); } } -//-------------------------------------------------------------------------------------------------- NTSTATUS CUsbDkRedirectorStrategy::PNPPreProcess(PIRP Irp) { @@ -191,7 +186,6 @@ NTSTATUS CUsbDkRedirectorStrategy::PNPPreProcess(PIRP Irp) return CUsbDkFilterStrategy::PNPPreProcess(Irp); } } -//-------------------------------------------------------------------------------------------------- typedef struct tag_USBDK_REDIRECTOR_REQUEST_CONTEXT { @@ -274,7 +268,6 @@ static NTSTATUS CRedirectorRequest::FetchTransferRequest(USB_DK_TRANSFER_REQUEST return status; } -//-------------------------------------------------------------------------------------------------- template NTSTATUS CUsbDkRedirectorStrategy::IoInCallerContextRW(CRedirectorRequest &WdfRequest, @@ -328,7 +321,6 @@ NTSTATUS CUsbDkRedirectorStrategy::IoInCallerContextRW(CRedirectorRequest &WdfRe return status; } -//-------------------------------------------------------------------------------------------------- template NTSTATUS CUsbDkRedirectorStrategy::IoInCallerContextRWIsoTransfer(CRedirectorRequest &WdfRequest, USB_DK_TRANSFER_REQUEST &TransferRequest, @@ -365,7 +357,6 @@ NTSTATUS CUsbDkRedirectorStrategy::IoInCallerContextRWIsoTransfer(CRedirectorReq return status; } -//-------------------------------------------------------------------------------------------------- NTSTATUS CUsbDkRedirectorStrategy::IoInCallerContextRWControlTransfer(CRedirectorRequest &WdfRequest, USB_DK_TRANSFER_REQUEST &TransferRequest) { @@ -421,7 +412,6 @@ NTSTATUS CUsbDkRedirectorStrategy::IoInCallerContextRWControlTransfer(CRedirecto return status; } -//-------------------------------------------------------------------------------------------------- void CUsbDkRedirectorStrategy::IoInCallerContext(WDFDEVICE Device, WDFREQUEST Request) { @@ -466,7 +456,6 @@ void CUsbDkRedirectorStrategy::IoInCallerContext(WDFDEVICE Device, WDFREQUEST Re WdfRequest.SetStatus(status); } } -//-------------------------------------------------------------------------------------------------- void CUsbDkRedirectorStrategy::DoControlTransfer(CRedirectorRequest &WdfRequest, WDFMEMORY DataBuffer) { @@ -509,7 +498,6 @@ void CUsbDkRedirectorStrategy::DoControlTransfer(CRedirectorRequest &WdfRequest, WdfRequest.SetStatus(status); } -//-------------------------------------------------------------------------------------------------- void CUsbDkRedirectorStrategy::IoDeviceControl(WDFREQUEST Request, size_t OutputBufferLength, size_t InputBufferLength, @@ -552,7 +540,6 @@ void CUsbDkRedirectorStrategy::IoDeviceControl(WDFREQUEST Request, } } } -//-------------------------------------------------------------------------------------------------- void CUsbDkRedirectorStrategy::WritePipe(WDFREQUEST Request, size_t Length) { @@ -617,7 +604,6 @@ void CUsbDkRedirectorStrategy::WritePipe(WDFREQUEST Request, size_t Length) WdfRequest.SetStatus(STATUS_INVALID_PARAMETER); } } -//-------------------------------------------------------------------------------------------------- void CUsbDkRedirectorStrategy::ReadPipe(WDFREQUEST Request, size_t Length) { @@ -681,7 +667,6 @@ void CUsbDkRedirectorStrategy::ReadPipe(WDFREQUEST Request, size_t Length) WdfRequest.SetStatus(STATUS_INVALID_PARAMETER); } } -//-------------------------------------------------------------------------------------------------- void CUsbDkRedirectorStrategy::IsoRWCompletion(WDFREQUEST Request, WDFIOTARGET, PWDF_REQUEST_COMPLETION_PARAMS CompletionParams, WDFCONTEXT) { @@ -716,13 +701,11 @@ void CUsbDkRedirectorStrategy::IsoRWCompletion(WDFREQUEST Request, WDFIOTARGET, WdfRequest.SetStatus(status); } -//-------------------------------------------------------------------------------------------------- size_t CUsbDkRedirectorStrategy::GetRequestContextSize() { return sizeof(USBDK_REDIRECTOR_REQUEST_CONTEXT); } -//-------------------------------------------------------------------------------------------------- void CUsbDkRedirectorStrategy::OnClose() { @@ -735,7 +718,6 @@ void CUsbDkRedirectorStrategy::OnClose() TraceEvents(TRACE_LEVEL_ERROR, TRACE_REDIRECTOR, "%!FUNC! RemoveRedirect failed: %!STATUS!", status); } } -//-------------------------------------------------------------------------------------------------- void CUsbDkRedirectorQueueData::SetCallbacks(WDF_IO_QUEUE_CONFIG &QueueConfig) { @@ -744,7 +726,6 @@ void CUsbDkRedirectorQueueData::SetCallbacks(WDF_IO_QUEUE_CONFIG &QueueConfig) QueueConfig.EvtIoRead = [](WDFQUEUE Q, WDFREQUEST R, size_t L) { UsbDkFilterGetContext(WdfIoQueueGetDevice(Q))->UsbDkFilter->m_Strategy->ReadPipe(R, L); }; } -//-------------------------------------------------------------------------------------------------- NTSTATUS CUsbDkRedirectorQueueData::SetDispatching() { @@ -761,11 +742,9 @@ NTSTATUS CUsbDkRedirectorQueueData::SetDispatching() } return status; } -//-------------------------------------------------------------------------------------------------- void CUsbDkRedirectorQueueConfig::SetCallbacks(WDF_IO_QUEUE_CONFIG &QueueConfig) { QueueConfig.EvtIoDeviceControl = [](WDFQUEUE Q, WDFREQUEST R, size_t OL, size_t IL, ULONG CTL) { UsbDkFilterGetContext(WdfIoQueueGetDevice(Q))->UsbDkFilter->m_Strategy->IoDeviceControl(R, OL, IL, CTL); };; } -//-------------------------------------------------------------------------------------------------- diff --git a/UsbDk/RedirectorStrategy.h b/UsbDk/RedirectorStrategy.h index 1e774bd..4e8017f 100644 --- a/UsbDk/RedirectorStrategy.h +++ b/UsbDk/RedirectorStrategy.h @@ -43,7 +43,6 @@ class CUsbDkRedirectorQueueData : public CWdfSpecificQueue, public CAllocatable< CUsbDkRedirectorQueueData(const CUsbDkRedirectorQueueData&) = delete; CUsbDkRedirectorQueueData& operator= (const CUsbDkRedirectorQueueData&) = delete; }; -//-------------------------------------------------------------------------------------------------- class CUsbDkRedirectorQueueConfig : public CWdfDefaultQueue, public CAllocatable { @@ -57,7 +56,6 @@ class CUsbDkRedirectorQueueConfig : public CWdfDefaultQueue, public CAllocatable CUsbDkRedirectorQueueConfig(const CUsbDkRedirectorQueueConfig&) = delete; CUsbDkRedirectorQueueConfig& operator= (const CUsbDkRedirectorQueueConfig&) = delete; }; -//-------------------------------------------------------------------------------------------------- class CRedirectorRequest; diff --git a/UsbDk/UsbTarget.cpp b/UsbDk/UsbTarget.cpp index 29bcbb2..982219c 100644 --- a/UsbDk/UsbTarget.cpp +++ b/UsbDk/UsbTarget.cpp @@ -153,7 +153,6 @@ void CWdfUsbPipe::WriteAsync(CWdfRequest &Request, WDFMEMORY Buffer, PFN_WDF_REQ } } } -//------------------------------------------------------------------------------------------------------------------- void CWdfUsbPipe::SubmitIsochronousTransfer(CWdfRequest &Request, CIsochronousUrb::Direction Direction, @@ -191,7 +190,6 @@ void CWdfUsbPipe::SubmitIsochronousTransfer(CWdfRequest &Request, TraceEvents(TRACE_LEVEL_ERROR, TRACE_USBTARGET, "%!FUNC! send failed: %!STATUS!", status); } } -//------------------------------------------------------------------------------------------------------------------- NTSTATUS CWdfUsbPipe::Abort(WDFREQUEST Request) { @@ -341,7 +339,6 @@ void CWdfUsbTarget::ReadPipeAsync(WDFREQUEST Request, ULONG64 EndpointAddress, W WdfRequest.SetStatus(STATUS_NOT_FOUND); } } -//---------------------------------------------------------------------------------------------------------- void CWdfUsbTarget::ReadIsochronousPipeAsync(WDFREQUEST Request, ULONG64 EndpointAddress, WDFMEMORY Buffer, PULONG64 PacketSizes, size_t PacketNumber, @@ -360,7 +357,6 @@ void CWdfUsbTarget::ReadIsochronousPipeAsync(WDFREQUEST Request, ULONG64 Endpoin WdfRequest.SetStatus(STATUS_NOT_FOUND); } } -//---------------------------------------------------------------------------------------------------------- void CWdfUsbTarget::WriteIsochronousPipeAsync(WDFREQUEST Request, ULONG64 EndpointAddress, WDFMEMORY Buffer, PULONG64 PacketSizes, size_t PacketNumber, @@ -379,7 +375,6 @@ void CWdfUsbTarget::WriteIsochronousPipeAsync(WDFREQUEST Request, ULONG64 Endpoi WdfRequest.SetStatus(STATUS_NOT_FOUND); } } -//---------------------------------------------------------------------------------------------------------- NTSTATUS CWdfUsbTarget::AbortPipe(WDFREQUEST Request, ULONG64 EndpointAddress) { diff --git a/UsbDkController/UsbDkController.cpp b/UsbDkController/UsbDkController.cpp index f4cd8b4..cffaf23 100644 --- a/UsbDkController/UsbDkController.cpp +++ b/UsbDkController/UsbDkController.cpp @@ -28,7 +28,6 @@ #include "UsbDkDataHider.h" using namespace std; -//------------------------------------------------------------------------------- static void ShowUsage() { @@ -51,7 +50,6 @@ static void ShowUsage() tcout << TEXT(" Should be 0 or 1, if 0, the rule is terminal") << endl; tcout << endl; } -//------------------------------------------------------------------------------- static int Controller_AnalyzeInstallResult(InstallResult Res, const tstring &OpName) { @@ -79,7 +77,6 @@ static int Controller_InstallDriver() auto res = UsbDk_InstallDriver(); return Controller_AnalyzeInstallResult(res, TEXT("UsbDk driver installation")); } -//------------------------------------------------------------------------------- static int Controller_UninstallDriver() { @@ -95,7 +92,6 @@ static int Controller_UninstallDriver() return 1; } } -//------------------------------------------------------------------------------- static void Controller_DumpConfigurationDescriptors(USB_DK_DEVICE_INFO &Device) { @@ -119,7 +115,6 @@ static void Controller_DumpConfigurationDescriptors(USB_DK_DEVICE_INFO &Device) } } } -//------------------------------------------------------------------------------- static int Controller_EnumerateDevices() { @@ -160,7 +155,6 @@ static int Controller_EnumerateDevices() return 1; } } -//------------------------------------------------------------------------------- static int Controller_RedirectDevice(TCHAR *DeviceID, TCHAR *InstanceID) { @@ -193,7 +187,6 @@ static int Controller_RedirectDevice(TCHAR *DeviceID, TCHAR *InstanceID) } } -//------------------------------------------------------------------------------- static bool Controller_ParseIntRuleField(const TCHAR *Name, const TCHAR * Str, ULONG64 &Value) { @@ -308,7 +301,6 @@ static void Controller_HideDevice(TCHAR *VID, TCHAR *PID, TCHAR *BCD, TCHAR *Usb UsbDk_CloseHiderHandle(hiderHandle); } -//------------------------------------------------------------------------------- static bool Controller_ChdirToPackageFolder() { @@ -337,7 +329,6 @@ static bool Controller_ChdirToPackageFolder() return true; } -//------------------------------------------------------------------------------- int __cdecl _tmain(int argc, TCHAR* argv[]) { @@ -414,4 +405,3 @@ int __cdecl _tmain(int argc, TCHAR* argv[]) return -4; } } -//------------------------------------------------------------------------------- diff --git a/UsbDkHelper/DeviceMgr.cpp b/UsbDkHelper/DeviceMgr.cpp index cc8ee03..0917092 100644 --- a/UsbDkHelper/DeviceMgr.cpp +++ b/UsbDkHelper/DeviceMgr.cpp @@ -48,7 +48,6 @@ bool DeviceMgr::ResetDeviceByClass(const GUID &ClassGuid) return true; } -//-------------------------------------------------------------------------------- bool DeviceMgr::ResetDevice(HDEVINFO devs, PSP_DEVINFO_DATA devInfo) { @@ -76,4 +75,3 @@ bool DeviceMgr::ResetDevice(HDEVINFO devs, PSP_DEVINFO_DATA devInfo) return true; } -//-------------------------------------------------------------------------------- diff --git a/UsbDkHelper/DeviceMgr.h b/UsbDkHelper/DeviceMgr.h index 105dcf0..3bc6941 100644 --- a/UsbDkHelper/DeviceMgr.h +++ b/UsbDkHelper/DeviceMgr.h @@ -26,7 +26,6 @@ #include #include "UsbDkHelper.h" -//----------------------------------------------------------------------------------- #define DEVICE_MANAGER_EXCEPTION_STRING TEXT("DeviceMgr exception: ") class UsbDkDeviceMgrException : public UsbDkW32ErrorException @@ -38,7 +37,6 @@ class UsbDkDeviceMgrException : public UsbDkW32ErrorException UsbDkDeviceMgrException(tstring errMsg) : UsbDkW32ErrorException(tstring(DEVICE_MANAGER_EXCEPTION_STRING) + errMsg){} UsbDkDeviceMgrException(tstring errMsg, DWORD dwErrorCode) : UsbDkW32ErrorException(tstring(DEVICE_MANAGER_EXCEPTION_STRING) + errMsg, dwErrorCode){} }; -//----------------------------------------------------------------------------------- class DeviceMgr { @@ -47,4 +45,3 @@ class DeviceMgr private: static bool ResetDevice(HDEVINFO devs, PSP_DEVINFO_DATA devInfo); }; -//----------------------------------------------------------------------------------- \ No newline at end of file diff --git a/UsbDkHelper/DriverAccess.cpp b/UsbDkHelper/DriverAccess.cpp index 41f4b4e..fb0d81f 100644 --- a/UsbDkHelper/DriverAccess.cpp +++ b/UsbDkHelper/DriverAccess.cpp @@ -25,7 +25,6 @@ #include "DriverAccess.h" #include "Public.h" -//------------------------------------------------------------------------------------------------ void UsbDkDriverAccess::GetDevicesList(PUSB_DK_DEVICE_INFO &DevicesArray, ULONG &DeviceNumber) { @@ -56,19 +55,16 @@ void UsbDkDriverAccess::GetDevicesList(PUSB_DK_DEVICE_INFO &DevicesArray, ULONG DeviceNumber = bytesReturned / sizeof(USB_DK_DEVICE_INFO); DevicesArray = Result.release(); } -//------------------------------------------------------------------------------------------------ void UsbDkDriverAccess::ReleaseConfigurationDescriptor(PUSB_CONFIGURATION_DESCRIPTOR Descriptor) { delete[] Descriptor; } -//------------------------------------------------------------------------------------------------ void UsbDkDriverAccess::ReleaseDevicesList(PUSB_DK_DEVICE_INFO DevicesArray) { delete[] DevicesArray; } -//------------------------------------------------------------------------------------------------ PUSB_CONFIGURATION_DESCRIPTOR UsbDkDriverAccess::GetConfigurationDescriptor(USB_DK_CONFIG_DESCRIPTOR_REQUEST &Request, ULONG &Length) { @@ -86,7 +82,6 @@ PUSB_CONFIGURATION_DESCRIPTOR UsbDkDriverAccess::GetConfigurationDescriptor(USB_ return FullDescriptor; } -//------------------------------------------------------------------------------------------------ void UsbDkDriverAccess::UpdateRegistryParameters() { @@ -99,7 +94,6 @@ HANDLE UsbDkDriverAccess::AddRedirect(USB_DK_DEVICE_ID &DeviceID) SendIoctlWithDeviceId(IOCTL_USBDK_ADD_REDIRECT, DeviceID, &RedirectorHandle); return reinterpret_cast(RedirectorHandle); } -//------------------------------------------------------------------------------------------------ void UsbDkHiderAccess::AddHideRule(const USB_DK_HIDE_RULE &Rule) { diff --git a/UsbDkHelper/DriverAccess.h b/UsbDkHelper/DriverAccess.h index 8f45fba..2b407d2 100644 --- a/UsbDkHelper/DriverAccess.h +++ b/UsbDkHelper/DriverAccess.h @@ -28,7 +28,6 @@ #include "DriverFile.h" #include "UsbDkNames.h" -//----------------------------------------------------------------------------------- #define DRIVER_ACCESS_EXCEPTION_STRING TEXT("Driver operation error. ") class UsbDkDriverAccessException : public UsbDkW32ErrorException @@ -40,7 +39,6 @@ class UsbDkDriverAccessException : public UsbDkW32ErrorException UsbDkDriverAccessException(tstring errMsg) : UsbDkW32ErrorException(tstring(DRIVER_ACCESS_EXCEPTION_STRING) + errMsg){} UsbDkDriverAccessException(tstring errMsg, DWORD dwErrorCode) : UsbDkW32ErrorException(tstring(DRIVER_ACCESS_EXCEPTION_STRING) + errMsg, dwErrorCode){} }; -//----------------------------------------------------------------------------------- class UsbDkDriverAccess : public UsbDkDriverFile { public: @@ -64,7 +62,6 @@ class UsbDkDriverAccess : public UsbDkDriverFile Output, (Output != nullptr) ? sizeof(*Output) : 0); } }; -//----------------------------------------------------------------------------------- class UsbDkHiderAccess : public UsbDkDriverFile { diff --git a/UsbDkHelper/DriverFile.cpp b/UsbDkHelper/DriverFile.cpp index 16ba4e8..3f3991d 100644 --- a/UsbDkHelper/DriverFile.cpp +++ b/UsbDkHelper/DriverFile.cpp @@ -24,7 +24,6 @@ #include "stdafx.h" #include "DriverFile.h" -//------------------------------------------------------------------------------------------------ UsbDkDriverFile::UsbDkDriverFile(LPCTSTR lpFileName, bool bOverlapped) { @@ -43,7 +42,6 @@ UsbDkDriverFile::UsbDkDriverFile(LPCTSTR lpFileName, bool bOverlapped) throw UsbDkDriverFileException(tstring(TEXT("Failed to open device symlink ")) + lpFileName); } } -//------------------------------------------------------------------------------------------------ TransferResult UsbDkDriverFile::Ioctl(DWORD Code, bool ShortBufferOk, diff --git a/UsbDkHelper/DriverFile.h b/UsbDkHelper/DriverFile.h index 80bcfca..fb72450 100644 --- a/UsbDkHelper/DriverFile.h +++ b/UsbDkHelper/DriverFile.h @@ -25,7 +25,6 @@ #include "UsbDkData.h" -//----------------------------------------------------------------------------------- #define DRIVER_FILE_EXCEPTION_STRING TEXT("Driver file operation error. ") class UsbDkDriverFileException : public UsbDkW32ErrorException @@ -37,7 +36,6 @@ class UsbDkDriverFileException : public UsbDkW32ErrorException UsbDkDriverFileException(tstring errMsg) : UsbDkW32ErrorException(tstring(DRIVER_FILE_EXCEPTION_STRING) + errMsg){} UsbDkDriverFileException(tstring errMsg, DWORD dwErrorCode) : UsbDkW32ErrorException(tstring(DRIVER_FILE_EXCEPTION_STRING) + errMsg, dwErrorCode){} }; -//----------------------------------------------------------------------------------- class UsbDkDriverFile { public: @@ -73,4 +71,3 @@ class UsbDkDriverFile private: bool m_bOverlapped; }; -//----------------------------------------------------------------------------------- \ No newline at end of file diff --git a/UsbDkHelper/Exception.h b/UsbDkHelper/Exception.h index 44fb6a9..dfbda9f 100644 --- a/UsbDkHelper/Exception.h +++ b/UsbDkHelper/Exception.h @@ -26,7 +26,6 @@ #include "tstrings.h" using std::exception; -//---------------------------------------------------------------------------------------------- class UsbDkException : public exception { @@ -47,7 +46,6 @@ class UsbDkException : public exception tstring m_Message; string m_MBCSMessage; }; -//---------------------------------------------------------------------------------------------- class UsbDkNumErrorException : public UsbDkException { @@ -61,7 +59,6 @@ class UsbDkNumErrorException : public UsbDkException protected: DWORD m_dwErrorCode; }; -//---------------------------------------------------------------------------------------------- class UsbDkCRTErrorException : public UsbDkNumErrorException { @@ -74,7 +71,6 @@ class UsbDkCRTErrorException : public UsbDkNumErrorException protected: static tstring GetErrorString(DWORD dwErrorCode); }; -//---------------------------------------------------------------------------------------------- #ifdef WIN32 class UsbDkW32ErrorException : public UsbDkNumErrorException @@ -89,4 +85,3 @@ class UsbDkW32ErrorException : public UsbDkNumErrorException static tstring GetErrorString(DWORD dwErrorCode); }; #endif -//---------------------------------------------------------------------------------------------- diff --git a/UsbDkHelper/Installer.cpp b/UsbDkHelper/Installer.cpp index 99768b6..3ab4ab7 100644 --- a/UsbDkHelper/Installer.cpp +++ b/UsbDkHelper/Installer.cpp @@ -26,7 +26,6 @@ #include "Public.h" #include "DeviceMgr.h" -//------------------------------------------------------------------------------------------ #define SYSTEM32_DRIVERS TEXT("\\System32\\Drivers\\") @@ -34,7 +33,6 @@ #define UPPER_FILTER_REGISTRY_KEY TEXT("UpperFilters") using namespace std; -//------------------------------------------------------------------------------------------ UsbDkInstaller::UsbDkInstaller() { @@ -42,7 +40,6 @@ UsbDkInstaller::UsbDkInstaller() m_regAccess.SetPrimaryKey(HKEY_LOCAL_MACHINE); } -//-------------------------------------------------------------------------------- bool UsbDkInstaller::Install(bool &NeedRollBack) { @@ -59,7 +56,6 @@ bool UsbDkInstaller::Install(bool &NeedRollBack) return rebootRequired ? false : DeviceMgr::ResetDeviceByClass(GUID_DEVINTERFACE_USB_HOST_CONTROLLER); } -//-------------------------------------------------------------------------------- void UsbDkInstaller::Uninstall() { @@ -77,7 +73,6 @@ void UsbDkInstaller::Uninstall() m_wdfCoinstaller.PostDeviceRemove(infFilePath); } -//-------------------------------------------------------------------------------- tstring UsbDkInstaller::CopyDriver() { @@ -98,7 +93,6 @@ tstring UsbDkInstaller::CopyDriver() return driverDestLocation; } -//------------------------------------------------------------------------------------------- void UsbDkInstaller::DeleteDriver() { @@ -114,7 +108,6 @@ void UsbDkInstaller::DeleteDriver() return; } } -//------------------------------------------------------------------------------------------- tstring UsbDkInstaller::buildDriverPath(const tstring &DriverFileName) { @@ -123,7 +116,6 @@ tstring UsbDkInstaller::buildDriverPath(const tstring &DriverFileName) return tstring(driverDestPath) + SYSTEM32_DRIVERS + DriverFileName; } -//------------------------------------------------------------------------------------------- tstring UsbDkInstaller::buildInfFilePath() { @@ -135,7 +127,6 @@ tstring UsbDkInstaller::buildInfFilePath() return tstring(currDir) + TEXT("\\") + USBDK_DRIVER_INF_NAME; } -//------------------------------------------------------------------------------------------- void UsbDkInstaller::addUsbDkToRegistry() { @@ -183,7 +174,6 @@ void UsbDkInstaller::addUsbDkToRegistry() throw UsbDkInstallerFailedException(TEXT("addUsbDkToRegistry failed in WriteMultiString.")); } } -//---------------------------------------------------------------------------- void UsbDkInstaller::removeUsbDkFromRegistry() { @@ -236,7 +226,6 @@ void UsbDkInstaller::removeUsbDkFromRegistry() } } } -//---------------------------------------------------------------------------- void UsbDkInstaller::buildMultiStringVectorFromList(vector &valVector, tstringlist &newfiltersList) { @@ -251,7 +240,6 @@ void UsbDkInstaller::buildMultiStringVectorFromList(vector &valVector, ts } valVector.push_back(TEXT('\0')); } -//---------------------------------------------------------------------------- void UsbDkInstaller::buildStringListFromVector(tstringlist &filtersList, vector &valVector) { @@ -275,7 +263,6 @@ void UsbDkInstaller::buildStringListFromVector(tstringlist &filtersList, vector< } while (!currFilter.empty()); } -//---------------------------------------------------------------------------- void UsbDkInstaller::buildNewListWithoutEement(tstringlist &newfiltersList, tstringlist &filtersList, tstring element) { @@ -287,7 +274,6 @@ void UsbDkInstaller::buildNewListWithoutEement(tstringlist &newfiltersList, tstr } } } -//---------------------------------------------------------------------------- void UsbDkInstaller::validatePlatform() { @@ -296,7 +282,6 @@ void UsbDkInstaller::validatePlatform() throw UsbDkInstallerFailedException(TEXT("Running 32Bit package on 64Bit OS not supported.")); } } -//---------------------------------------------------------------------------- bool UsbDkInstaller::isWow64B() { @@ -314,4 +299,3 @@ bool UsbDkInstaller::isWow64B() } return bIsWow64 ? true : false; } -//---------------------------------------------------------------------------- diff --git a/UsbDkHelper/Installer.h b/UsbDkHelper/Installer.h index 6a1a492..52f6aca 100644 --- a/UsbDkHelper/Installer.h +++ b/UsbDkHelper/Installer.h @@ -28,7 +28,6 @@ #include "UsbDkHelper.h" #include "RegAccess.h" -//----------------------------------------------------------------------------------- #define INSTALLER_EXCEPTION_STRING TEXT("UsbDkInstaller exception: ") class UsbDkInstallerFailedException : public UsbDkW32ErrorException @@ -40,7 +39,6 @@ class UsbDkInstallerFailedException : public UsbDkW32ErrorException UsbDkInstallerFailedException(tstring errMsg) : UsbDkW32ErrorException(tstring(INSTALLER_EXCEPTION_STRING) + errMsg){} UsbDkInstallerFailedException(tstring errMsg, DWORD dwErrorCode) : UsbDkW32ErrorException(tstring(INSTALLER_EXCEPTION_STRING) + errMsg, dwErrorCode){} }; -//----------------------------------------------------------------------------------- class UsbDkInstaller { @@ -72,4 +70,3 @@ class UsbDkInstaller bool isWow64B(); }; -//----------------------------------------------------------------------------------- diff --git a/UsbDkHelper/RedirectorAccess.cpp b/UsbDkHelper/RedirectorAccess.cpp index 35802e7..e4dafee 100644 --- a/UsbDkHelper/RedirectorAccess.cpp +++ b/UsbDkHelper/RedirectorAccess.cpp @@ -29,7 +29,6 @@ void UsbDkRedirectorAccess::AbortPipe(ULONG64 PipeAddress) { IoctlSync(IOCTL_USBDK_DEVICE_ABORT_PIPE, false, &PipeAddress, sizeof(PipeAddress)); } -//------------------------------------------------------------------------------------------------ void UsbDkRedirectorAccess::SetAltsetting(ULONG64 InterfaceIdx, ULONG64 AltSettingIdx) { @@ -39,13 +38,11 @@ void UsbDkRedirectorAccess::SetAltsetting(ULONG64 InterfaceIdx, ULONG64 AltSetti IoctlSync(IOCTL_USBDK_DEVICE_SET_ALTSETTING, false, &AltSetting, sizeof(AltSetting)); } -//------------------------------------------------------------------------------------------------ void UsbDkRedirectorAccess::ResetDevice() { IoctlSync(IOCTL_USBDK_DEVICE_RESET_DEVICE); } -//------------------------------------------------------------------------------------------------ bool UsbDkRedirectorAccess::IoctlSync(DWORD Code, bool ShortBufferOk, diff --git a/UsbDkHelper/RedirectorAccess.h b/UsbDkHelper/RedirectorAccess.h index 679a392..283ec6c 100644 --- a/UsbDkHelper/RedirectorAccess.h +++ b/UsbDkHelper/RedirectorAccess.h @@ -27,7 +27,6 @@ #include "DriverFile.h" #include "UsbDkNames.h" -//----------------------------------------------------------------------------------- #define REDIRECTOR_ACCESS_EXCEPTION_STRING TEXT("Redirection operation error. ") class UsbDkRedirectorAccessException : public UsbDkW32ErrorException @@ -39,7 +38,6 @@ class UsbDkRedirectorAccessException : public UsbDkW32ErrorException UsbDkRedirectorAccessException(tstring errMsg) : UsbDkW32ErrorException(tstring(REDIRECTOR_ACCESS_EXCEPTION_STRING) + errMsg){} UsbDkRedirectorAccessException(tstring errMsg, DWORD dwErrorCode) : UsbDkW32ErrorException(tstring(REDIRECTOR_ACCESS_EXCEPTION_STRING) + errMsg, dwErrorCode){} }; -//----------------------------------------------------------------------------------- class UsbDkRedirectorAccess : public UsbDkDriverFile { public: @@ -75,4 +73,3 @@ class UsbDkRedirectorAccess : public UsbDkDriverFile DWORD OutBufferSize = 0, LPDWORD BytesReturned = nullptr); }; -//----------------------------------------------------------------------------------- \ No newline at end of file diff --git a/UsbDkHelper/RegAccess.cpp b/UsbDkHelper/RegAccess.cpp index 4f5445a..9f0dda9 100644 --- a/UsbDkHelper/RegAccess.cpp +++ b/UsbDkHelper/RegAccess.cpp @@ -174,7 +174,6 @@ DWORD UsbDkRegAccess::ReadString(LPCTSTR lpzValueName, return dwRes; } -//----------------------------------------------------------------------------------------- LONG UsbDkRegAccess::ReadMultiString(LPCTSTR lpzValueName, LPTSTR lpzData, @@ -211,7 +210,6 @@ LONG UsbDkRegAccess::ReadMultiString(LPCTSTR lpzValueName, return errorCode; } -//----------------------------------------------------------------------------------------- DWORD UsbDkRegAccess::ReadBinary(LPCTSTR lpzValueName, LPBYTE lpzData, @@ -385,7 +383,6 @@ BOOL UsbDkRegAccess::WriteString(LPCTSTR lpzValueName, return bResult; } -//---------------------------------------------------------------------------------------------------- BOOL UsbDkRegAccess::WriteMultiString(LPCTSTR lpzValueName, LPCTSTR lpzValue, @@ -423,7 +420,6 @@ BOOL UsbDkRegAccess::WriteMultiString(LPCTSTR lpzValueName, return bResult; } -//---------------------------------------------------------------------------------------------------- BOOL UsbDkRegAccess::WriteBinary(LPCTSTR lpzValueName, LPCBYTE lpData, diff --git a/UsbDkHelper/ServiceManager.cpp b/UsbDkHelper/ServiceManager.cpp index 7b2e865..7265464 100644 --- a/UsbDkHelper/ServiceManager.cpp +++ b/UsbDkHelper/ServiceManager.cpp @@ -23,7 +23,6 @@ #include "stdafx.h" -//-------------------------------------------------------------------------------- ServiceManager::ServiceManager() :m_schSCManager(OpenSCManager(nullptr, nullptr, SC_MANAGER_ALL_ACCESS)) @@ -33,7 +32,6 @@ ServiceManager::ServiceManager() throw UsbDkServiceManagerFailedException(TEXT("OpenSCManager failed")); } } -//-------------------------------------------------------------------------------- void ServiceManager::CreateServiceObject(const tstring &ServiceName, const tstring &ServicePath) { @@ -46,7 +44,6 @@ void ServiceManager::CreateServiceObject(const tstring &ServiceName, const tstri throw UsbDkServiceManagerFailedException(TEXT("CreateService failed")); } } -//-------------------------------------------------------------------------------- void ServiceManager::DeleteServiceObject(const tstring &ServiceName) { @@ -69,7 +66,6 @@ void ServiceManager::DeleteServiceObject(const tstring &ServiceName) throw UsbDkServiceManagerFailedException(TEXT("DeleteService failed")); } } -//-------------------------------------------------------------------------------- void ServiceManager::WaitForServiceStop(const SCMHandleHolder &schService) { @@ -90,4 +86,3 @@ void ServiceManager::WaitForServiceStop(const SCMHandleHolder &schService) } } while ((ssp.dwCurrentState != SERVICE_STOPPED) && (iterationNumber++ < SERVICE_STOP_ITERATIONS)); } -//-------------------------------------------------------------------------------- diff --git a/UsbDkHelper/ServiceManager.h b/UsbDkHelper/ServiceManager.h index dfde2fe..7cae9f9 100644 --- a/UsbDkHelper/ServiceManager.h +++ b/UsbDkHelper/ServiceManager.h @@ -23,7 +23,6 @@ #pragma once -//----------------------------------------------------------------------------------- #define SERVICE_MANAGER_EXCEPTION_STRING TEXT("ServiceManager exception: ") class UsbDkServiceManagerFailedException : public UsbDkW32ErrorException @@ -35,7 +34,6 @@ class UsbDkServiceManagerFailedException : public UsbDkW32ErrorException UsbDkServiceManagerFailedException(tstring errMsg) : UsbDkW32ErrorException(tstring(SERVICE_MANAGER_EXCEPTION_STRING) + errMsg){} UsbDkServiceManagerFailedException(tstring errMsg, DWORD dwErrorCode) : UsbDkW32ErrorException(tstring(SERVICE_MANAGER_EXCEPTION_STRING) + errMsg, dwErrorCode){} }; -//----------------------------------------------------------------------------------- class ServiceManager { @@ -52,4 +50,3 @@ class ServiceManager SCMHandleHolder m_schSCManager; }; -//----------------------------------------------------------------------------------- \ No newline at end of file diff --git a/UsbDkHelper/UsbDkHelper.cpp b/UsbDkHelper/UsbDkHelper.cpp index 17d12a2..41b1d00 100644 --- a/UsbDkHelper/UsbDkHelper.cpp +++ b/UsbDkHelper/UsbDkHelper.cpp @@ -32,14 +32,12 @@ #include "RedirectorAccess.h" #include "RuleManager.h" -//------------------------------------------------------------------------------------------- typedef struct tag_REDIRECTED_DEVICE_HANDLE { USB_DK_DEVICE_ID DeviceID; unique_ptr RedirectorAccess; } REDIRECTED_DEVICE_HANDLE, *PREDIRECTED_DEVICE_HANDLE; -//------------------------------------------------------------------------------------------- void printExceptionString(const char *errorStr) { @@ -47,7 +45,6 @@ void printExceptionString(const char *errorStr) OutputDebugString(tString.c_str()); tcout << tString; } -//------------------------------------------------------------------------------------------ InstallResult UsbDk_InstallDriver(void) { bool NeedRollBack = false; @@ -67,7 +64,6 @@ InstallResult UsbDk_InstallDriver(void) return InstallFailure; } } -//------------------------------------------------------------------------------------------- BOOL UsbDk_UninstallDriver(void) { @@ -83,7 +79,6 @@ BOOL UsbDk_UninstallDriver(void) return FALSE; } } -//------------------------------------------------------------------------------------------- DLL BOOL UsbDk_GetConfigurationDescriptor(PUSB_DK_CONFIG_DESCRIPTOR_REQUEST Request, PUSB_CONFIGURATION_DESCRIPTOR *Descriptor, @@ -101,7 +96,6 @@ DLL BOOL UsbDk_GetConfigurationDescriptor(PUSB_DK_CONFIG_DESCRIPTOR_REQUEST Requ return FALSE; } } -//------------------------------------------------------------------------------------------- DLL void UsbDk_ReleaseConfigurationDescriptor(PUSB_CONFIGURATION_DESCRIPTOR Descriptor) { @@ -114,7 +108,6 @@ DLL void UsbDk_ReleaseConfigurationDescriptor(PUSB_CONFIGURATION_DESCRIPTOR Desc printExceptionString(e.what()); } } -//------------------------------------------------------------------------------------------- BOOL UsbDk_GetDevicesList(PUSB_DK_DEVICE_INFO *DevicesArray, PULONG NumberDevices) { @@ -130,7 +123,6 @@ BOOL UsbDk_GetDevicesList(PUSB_DK_DEVICE_INFO *DevicesArray, PULONG NumberDevice return FALSE; } } -//------------------------------------------------------------------------------------------- void UsbDk_ReleaseDevicesList(PUSB_DK_DEVICE_INFO DevicesArray) { @@ -143,7 +135,6 @@ void UsbDk_ReleaseDevicesList(PUSB_DK_DEVICE_INFO DevicesArray) printExceptionString(e.what()); } } -//------------------------------------------------------------------------------------------- HANDLE UsbDk_StartRedirect(PUSB_DK_DEVICE_ID DeviceID) { @@ -162,7 +153,6 @@ HANDLE UsbDk_StartRedirect(PUSB_DK_DEVICE_ID DeviceID) return INVALID_HANDLE_VALUE; } } -//------------------------------------------------------------------------------------------- BOOL UsbDk_StopRedirect(HANDLE DeviceHandle) { @@ -179,7 +169,6 @@ BOOL UsbDk_StopRedirect(HANDLE DeviceHandle) return FALSE; } } -//------------------------------------------------------------------------------------------- TransferResult UsbDk_WritePipe(HANDLE DeviceHandle, PUSB_DK_TRANSFER_REQUEST Request, LPOVERLAPPED Overlapped) { @@ -194,7 +183,6 @@ TransferResult UsbDk_WritePipe(HANDLE DeviceHandle, PUSB_DK_TRANSFER_REQUEST Req return TransferFailure; } } -//------------------------------------------------------------------------------------------- TransferResult UsbDk_ReadPipe(HANDLE DeviceHandle, PUSB_DK_TRANSFER_REQUEST Request, LPOVERLAPPED Overlapped) { @@ -209,7 +197,6 @@ TransferResult UsbDk_ReadPipe(HANDLE DeviceHandle, PUSB_DK_TRANSFER_REQUEST Requ return TransferFailure; } } -//------------------------------------------------------------------------------------------- BOOL UsbDk_AbortPipe(HANDLE DeviceHandle, ULONG64 PipeAddress) { @@ -225,7 +212,6 @@ BOOL UsbDk_AbortPipe(HANDLE DeviceHandle, ULONG64 PipeAddress) return FALSE; } } -//------------------------------------------------------------------------------------------- BOOL UsbDk_SetAltsetting(HANDLE DeviceHandle, ULONG64 InterfaceIdx, ULONG64 AltSettingIdx) { @@ -241,7 +227,6 @@ BOOL UsbDk_SetAltsetting(HANDLE DeviceHandle, ULONG64 InterfaceIdx, ULONG64 AltS return FALSE; } } -//------------------------------------------------------------------------------------------- DLL BOOL UsbDk_ResetDevice(HANDLE DeviceHandle) { @@ -257,14 +242,12 @@ DLL BOOL UsbDk_ResetDevice(HANDLE DeviceHandle) return FALSE; } } -//------------------------------------------------------------------------------------------- HANDLE UsbDk_GetRedirectorSystemHandle(HANDLE DeviceHandle) { auto deviceHandle = reinterpret_cast(DeviceHandle); return deviceHandle->RedirectorAccess->GetSystemHandle(); } -//------------------------------------------------------------------------------------------- HANDLE UsbDk_CreateHiderHandle() { diff --git a/UsbDkHelper/WdfCoinstaller.cpp b/UsbDkHelper/WdfCoinstaller.cpp index 63d6bef..99889e4 100644 --- a/UsbDkHelper/WdfCoinstaller.cpp +++ b/UsbDkHelper/WdfCoinstaller.cpp @@ -25,7 +25,6 @@ #include "WdfCoinstaller.h" #include "tstrings.h" -//-------------------------------------------------------------------------------- #define WDF_SECTION_NAME TEXT("UsbDk.NT.Wdf") #if !TARGET_OS_WIN_XP @@ -34,18 +33,15 @@ #define COINSTALLER_VERSION TEXT("01009") #endif -//-------------------------------------------------------------------------------- WdfCoinstaller::WdfCoinstaller() { loadWdfCoinstaller(); } -//-------------------------------------------------------------------------------- WdfCoinstaller::~WdfCoinstaller() { freeWdfCoinstallerLibrary(); } -//-------------------------------------------------------------------------------- void WdfCoinstaller::loadWdfCoinstaller() { @@ -78,7 +74,6 @@ void WdfCoinstaller::loadWdfCoinstaller() throw; } } -//-------------------------------------------------------------------------------- bool WdfCoinstaller::PreDeviceInstallEx(const tstring &infFilePath) { @@ -101,7 +96,6 @@ bool WdfCoinstaller::PreDeviceInstallEx(const tstring &infFilePath) return true; } -//-------------------------------------------------------------------------------- void WdfCoinstaller::PostDeviceInstall(const tstring &infFilePath) { @@ -111,7 +105,6 @@ void WdfCoinstaller::PostDeviceInstall(const tstring &infFilePath) throw UsbDkWdfCoinstallerFailedException(TEXT("WdfPostDeviceInstall() failed"), res); } } -//-------------------------------------------------------------------------------- void WdfCoinstaller::PreDeviceRemove(const tstring &infFilePath) { @@ -121,7 +114,6 @@ void WdfCoinstaller::PreDeviceRemove(const tstring &infFilePath) throw UsbDkWdfCoinstallerFailedException(TEXT("WdfPreDeviceRemove() failed"), res); } } -//-------------------------------------------------------------------------------- void WdfCoinstaller::PostDeviceRemove(const tstring &infFilePath) { @@ -131,7 +123,6 @@ void WdfCoinstaller::PostDeviceRemove(const tstring &infFilePath) throw UsbDkWdfCoinstallerFailedException(TEXT("WdfPostDeviceRemove() failed"), res); } } -//-------------------------------------------------------------------------------- void WdfCoinstaller::freeWdfCoinstallerLibrary() { @@ -141,4 +132,3 @@ void WdfCoinstaller::freeWdfCoinstallerLibrary() m_wdfCoinstallerLibrary = nullptr; } } -//-------------------------------------------------------------------------------- diff --git a/UsbDkHelper/WdfCoinstaller.h b/UsbDkHelper/WdfCoinstaller.h index ce7b372..0e043fe 100644 --- a/UsbDkHelper/WdfCoinstaller.h +++ b/UsbDkHelper/WdfCoinstaller.h @@ -25,7 +25,6 @@ #include -//----------------------------------------------------------------------------------- #define WDF_COINSTALLER_EXCEPTION_STRING TEXT("WdfCoinstaller exception: ") class UsbDkWdfCoinstallerFailedException : public UsbDkW32ErrorException @@ -37,7 +36,6 @@ class UsbDkWdfCoinstallerFailedException : public UsbDkW32ErrorException UsbDkWdfCoinstallerFailedException(tstring errMsg) : UsbDkW32ErrorException(tstring(WDF_COINSTALLER_EXCEPTION_STRING) + errMsg){} UsbDkWdfCoinstallerFailedException(tstring errMsg, DWORD dwErrorCode) : UsbDkW32ErrorException(tstring(WDF_COINSTALLER_EXCEPTION_STRING) + errMsg, dwErrorCode){} }; -//----------------------------------------------------------------------------------- class WdfCoinstaller { public: @@ -74,4 +72,3 @@ class WdfCoinstaller void loadWdfCoinstaller(); void freeWdfCoinstallerLibrary(); }; -//----------------------------------------------------------------------------------- \ No newline at end of file diff --git a/UsbDkInstHelper/UsbDkInstHelper.cpp b/UsbDkInstHelper/UsbDkInstHelper.cpp index 4a9ae2a..cfdf084 100644 --- a/UsbDkInstHelper/UsbDkInstHelper.cpp +++ b/UsbDkInstHelper/UsbDkInstHelper.cpp @@ -78,7 +78,6 @@ static bool _ChdirToPackageFolder() return true; } -//------------------------------------------------------------------------------- int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {