mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 10:33:15 +00:00
Merge in 58534, 58627, and 58628 from trunk. After this, the 0.3.15 code is frozen.
svn path=/branches/ReactOS-0.3.15/; revision=58695
This commit is contained in:
parent
d1e9f87825
commit
55ed4f3766
11 changed files with 285 additions and 216 deletions
|
@ -19,9 +19,9 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Uncomment the line below to start services
|
* Uncomment the line below to start services
|
||||||
* using the SERVICE_START_PENDING state
|
* using the SERVICE_START_PENDING state.
|
||||||
*/
|
*/
|
||||||
// #define USE_SERVICE_START_PENDING
|
#define USE_SERVICE_START_PENDING
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Uncomment the line below to use asynchronous IO operations
|
* Uncomment the line below to use asynchronous IO operations
|
||||||
|
@ -38,6 +38,7 @@ LIST_ENTRY ServiceListHead;
|
||||||
static RTL_RESOURCE DatabaseLock;
|
static RTL_RESOURCE DatabaseLock;
|
||||||
static DWORD ResumeCount = 1;
|
static DWORD ResumeCount = 1;
|
||||||
|
|
||||||
|
/* The critical section synchronizes service controls commands */
|
||||||
static CRITICAL_SECTION ControlServiceCriticalSection;
|
static CRITICAL_SECTION ControlServiceCriticalSection;
|
||||||
static DWORD PipeTimeout = 30000; /* 30 Seconds */
|
static DWORD PipeTimeout = 30000; /* 30 Seconds */
|
||||||
|
|
||||||
|
@ -359,7 +360,7 @@ ScmGetServiceEntryByResumeCount(DWORD dwResumeCount)
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
ScmCreateNewServiceRecord(LPCWSTR lpServiceName,
|
ScmCreateNewServiceRecord(LPCWSTR lpServiceName,
|
||||||
PSERVICE *lpServiceRecord)
|
PSERVICE* lpServiceRecord)
|
||||||
{
|
{
|
||||||
PSERVICE lpService = NULL;
|
PSERVICE lpService = NULL;
|
||||||
|
|
||||||
|
@ -772,13 +773,11 @@ ScmCheckDriver(PSERVICE Service)
|
||||||
|
|
||||||
if (Service->Status.dwServiceType == SERVICE_KERNEL_DRIVER)
|
if (Service->Status.dwServiceType == SERVICE_KERNEL_DRIVER)
|
||||||
{
|
{
|
||||||
RtlInitUnicodeString(&DirName,
|
RtlInitUnicodeString(&DirName, L"\\Driver");
|
||||||
L"\\Driver");
|
|
||||||
}
|
}
|
||||||
else
|
else // if (Service->Status.dwServiceType == SERVICE_FILE_SYSTEM_DRIVER)
|
||||||
{
|
{
|
||||||
RtlInitUnicodeString(&DirName,
|
RtlInitUnicodeString(&DirName, L"\\FileSystem");
|
||||||
L"\\FileSystem");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
|
@ -1096,7 +1095,7 @@ Done:
|
||||||
static DWORD
|
static DWORD
|
||||||
ScmSendStartCommand(PSERVICE Service,
|
ScmSendStartCommand(PSERVICE Service,
|
||||||
DWORD argc,
|
DWORD argc,
|
||||||
LPWSTR *argv)
|
LPWSTR* argv)
|
||||||
{
|
{
|
||||||
PSCM_CONTROL_PACKET ControlPacket;
|
PSCM_CONTROL_PACKET ControlPacket;
|
||||||
SCM_REPLY_PACKET ReplyPacket;
|
SCM_REPLY_PACKET ReplyPacket;
|
||||||
|
@ -1496,7 +1495,7 @@ ScmWaitForServiceConnect(PSERVICE Service)
|
||||||
static DWORD
|
static DWORD
|
||||||
ScmStartUserModeService(PSERVICE Service,
|
ScmStartUserModeService(PSERVICE Service,
|
||||||
DWORD argc,
|
DWORD argc,
|
||||||
LPWSTR *argv)
|
LPWSTR* argv)
|
||||||
{
|
{
|
||||||
PROCESS_INFORMATION ProcessInformation;
|
PROCESS_INFORMATION ProcessInformation;
|
||||||
STARTUPINFOW StartupInfo;
|
STARTUPINFOW StartupInfo;
|
||||||
|
@ -1512,6 +1511,7 @@ ScmStartUserModeService(PSERVICE Service,
|
||||||
return ScmSendStartCommand(Service, argc, argv);
|
return ScmSendStartCommand(Service, argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Otherwise start its process */
|
||||||
ZeroMemory(&StartupInfo, sizeof(StartupInfo));
|
ZeroMemory(&StartupInfo, sizeof(StartupInfo));
|
||||||
StartupInfo.cb = sizeof(StartupInfo);
|
StartupInfo.cb = sizeof(StartupInfo);
|
||||||
ZeroMemory(&ProcessInformation, sizeof(ProcessInformation));
|
ZeroMemory(&ProcessInformation, sizeof(ProcessInformation));
|
||||||
|
@ -1551,9 +1551,7 @@ ScmStartUserModeService(PSERVICE Service,
|
||||||
if (dwError == ERROR_SUCCESS)
|
if (dwError == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Send start command */
|
/* Send start command */
|
||||||
dwError = ScmSendStartCommand(Service,
|
dwError = ScmSendStartCommand(Service, argc, argv);
|
||||||
argc,
|
|
||||||
argv);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1569,24 +1567,22 @@ ScmStartUserModeService(PSERVICE Service,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DWORD
|
static DWORD
|
||||||
ScmStartService(PSERVICE Service, DWORD argc, LPWSTR *argv)
|
ScmLoadService(PSERVICE Service,
|
||||||
|
DWORD argc,
|
||||||
|
LPWSTR* argv)
|
||||||
{
|
{
|
||||||
PSERVICE_GROUP Group = Service->lpGroup;
|
PSERVICE_GROUP Group = Service->lpGroup;
|
||||||
DWORD dwError = ERROR_SUCCESS;
|
DWORD dwError = ERROR_SUCCESS;
|
||||||
LPCWSTR ErrorLogStrings[2];
|
LPCWSTR ErrorLogStrings[2];
|
||||||
WCHAR szErrorBuffer[32];
|
WCHAR szErrorBuffer[32];
|
||||||
|
|
||||||
DPRINT("ScmStartService() called\n");
|
DPRINT("ScmLoadService() called\n");
|
||||||
|
|
||||||
DPRINT("Start Service %p (%S)\n", Service, Service->lpServiceName);
|
DPRINT("Start Service %p (%S)\n", Service, Service->lpServiceName);
|
||||||
|
|
||||||
EnterCriticalSection(&ControlServiceCriticalSection);
|
|
||||||
|
|
||||||
if (Service->Status.dwCurrentState != SERVICE_STOPPED)
|
if (Service->Status.dwCurrentState != SERVICE_STOPPED)
|
||||||
{
|
{
|
||||||
DPRINT("Service %S is already running!\n", Service->lpServiceName);
|
DPRINT("Service %S is already running!\n", Service->lpServiceName);
|
||||||
LeaveCriticalSection(&ControlServiceCriticalSection);
|
|
||||||
return ERROR_SERVICE_ALREADY_RUNNING;
|
return ERROR_SERVICE_ALREADY_RUNNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1602,7 +1598,7 @@ ScmStartService(PSERVICE Service, DWORD argc, LPWSTR *argv)
|
||||||
Service->Status.dwCurrentState = SERVICE_RUNNING;
|
Service->Status.dwCurrentState = SERVICE_RUNNING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else // if (Service->Status.dwServiceType & (SERVICE_WIN32 | SERVICE_INTERACTIVE_PROCESS))
|
||||||
{
|
{
|
||||||
/* Start user-mode service */
|
/* Start user-mode service */
|
||||||
dwError = ScmCreateOrReferenceServiceImage(Service);
|
dwError = ScmCreateOrReferenceServiceImage(Service);
|
||||||
|
@ -1625,9 +1621,7 @@ ScmStartService(PSERVICE Service, DWORD argc, LPWSTR *argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LeaveCriticalSection(&ControlServiceCriticalSection);
|
DPRINT("ScmLoadService() done (Error %lu)\n", dwError);
|
||||||
|
|
||||||
DPRINT("ScmStartService() done (Error %lu)\n", dwError);
|
|
||||||
|
|
||||||
if (dwError == ERROR_SUCCESS)
|
if (dwError == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -1677,18 +1671,81 @@ ScmStartService(PSERVICE Service, DWORD argc, LPWSTR *argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
ScmStartService(PSERVICE Service,
|
||||||
|
DWORD argc,
|
||||||
|
LPWSTR* argv)
|
||||||
|
{
|
||||||
|
DWORD dwError = ERROR_SUCCESS;
|
||||||
|
SC_RPC_LOCK Lock = NULL;
|
||||||
|
|
||||||
|
DPRINT("ScmStartService() called\n");
|
||||||
|
DPRINT("Start Service %p (%S)\n", Service, Service->lpServiceName);
|
||||||
|
|
||||||
|
/* Acquire the service control critical section, to synchronize starts */
|
||||||
|
EnterCriticalSection(&ControlServiceCriticalSection);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Acquire the user service start lock while the service is starting, if
|
||||||
|
* needed (i.e. if we are not starting it during the initialization phase).
|
||||||
|
* If we don't success, bail out.
|
||||||
|
*/
|
||||||
|
if (!ScmInitialize)
|
||||||
|
{
|
||||||
|
dwError = ScmAcquireServiceStartLock(TRUE, &Lock);
|
||||||
|
if (dwError != ERROR_SUCCESS) goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Really start the service */
|
||||||
|
dwError = ScmLoadService(Service, argc, argv);
|
||||||
|
|
||||||
|
/* Release the service start lock, if needed, and the critical section */
|
||||||
|
if (Lock) ScmReleaseServiceStartLock(&Lock);
|
||||||
|
|
||||||
|
done:
|
||||||
|
LeaveCriticalSection(&ControlServiceCriticalSection);
|
||||||
|
|
||||||
|
DPRINT("ScmStartService() done (Error %lu)\n", dwError);
|
||||||
|
|
||||||
|
return dwError;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
ScmAutoStartServices(VOID)
|
ScmAutoStartServices(VOID)
|
||||||
{
|
{
|
||||||
|
DWORD dwError = ERROR_SUCCESS;
|
||||||
|
SC_RPC_LOCK Lock = NULL;
|
||||||
|
|
||||||
PLIST_ENTRY GroupEntry;
|
PLIST_ENTRY GroupEntry;
|
||||||
PLIST_ENTRY ServiceEntry;
|
PLIST_ENTRY ServiceEntry;
|
||||||
PSERVICE_GROUP CurrentGroup;
|
PSERVICE_GROUP CurrentGroup;
|
||||||
PSERVICE CurrentService;
|
PSERVICE CurrentService;
|
||||||
WCHAR szSafeBootServicePath[MAX_PATH];
|
WCHAR szSafeBootServicePath[MAX_PATH];
|
||||||
DWORD dwError;
|
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
|
/* Acquire the service control critical section, to synchronize starts */
|
||||||
|
EnterCriticalSection(&ControlServiceCriticalSection);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Acquire the user service start lock while the service is starting, if
|
||||||
|
* needed (i.e. if we are not starting it during the initialization phase).
|
||||||
|
* If we don't success, bail out.
|
||||||
|
*/
|
||||||
|
if (!ScmInitialize)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Actually this code is never executed since we are called
|
||||||
|
* at initialization time, so that ScmInitialize == TRUE.
|
||||||
|
* But keep the code here if someday we are called later on
|
||||||
|
* for whatever reason...
|
||||||
|
*/
|
||||||
|
dwError = ScmAcquireServiceStartLock(TRUE, &Lock);
|
||||||
|
if (dwError != ERROR_SUCCESS) goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Clear 'ServiceVisited' flag (or set if not to start in Safe Mode) */
|
/* Clear 'ServiceVisited' flag (or set if not to start in Safe Mode) */
|
||||||
ServiceEntry = ServiceListHead.Flink;
|
ServiceEntry = ServiceListHead.Flink;
|
||||||
while (ServiceEntry != &ServiceListHead)
|
while (ServiceEntry != &ServiceListHead)
|
||||||
|
@ -1779,7 +1836,7 @@ ScmAutoStartServices(VOID)
|
||||||
(CurrentService->dwTag == CurrentGroup->TagArray[i]))
|
(CurrentService->dwTag == CurrentGroup->TagArray[i]))
|
||||||
{
|
{
|
||||||
CurrentService->ServiceVisited = TRUE;
|
CurrentService->ServiceVisited = TRUE;
|
||||||
ScmStartService(CurrentService, 0, NULL);
|
ScmLoadService(CurrentService, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
ServiceEntry = ServiceEntry->Flink;
|
ServiceEntry = ServiceEntry->Flink;
|
||||||
|
@ -1797,7 +1854,7 @@ ScmAutoStartServices(VOID)
|
||||||
(CurrentService->ServiceVisited == FALSE))
|
(CurrentService->ServiceVisited == FALSE))
|
||||||
{
|
{
|
||||||
CurrentService->ServiceVisited = TRUE;
|
CurrentService->ServiceVisited = TRUE;
|
||||||
ScmStartService(CurrentService, 0, NULL);
|
ScmLoadService(CurrentService, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
ServiceEntry = ServiceEntry->Flink;
|
ServiceEntry = ServiceEntry->Flink;
|
||||||
|
@ -1817,7 +1874,7 @@ ScmAutoStartServices(VOID)
|
||||||
(CurrentService->ServiceVisited == FALSE))
|
(CurrentService->ServiceVisited == FALSE))
|
||||||
{
|
{
|
||||||
CurrentService->ServiceVisited = TRUE;
|
CurrentService->ServiceVisited = TRUE;
|
||||||
ScmStartService(CurrentService, 0, NULL);
|
ScmLoadService(CurrentService, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
ServiceEntry = ServiceEntry->Flink;
|
ServiceEntry = ServiceEntry->Flink;
|
||||||
|
@ -1834,7 +1891,7 @@ ScmAutoStartServices(VOID)
|
||||||
(CurrentService->ServiceVisited == FALSE))
|
(CurrentService->ServiceVisited == FALSE))
|
||||||
{
|
{
|
||||||
CurrentService->ServiceVisited = TRUE;
|
CurrentService->ServiceVisited = TRUE;
|
||||||
ScmStartService(CurrentService, 0, NULL);
|
ScmLoadService(CurrentService, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
ServiceEntry = ServiceEntry->Flink;
|
ServiceEntry = ServiceEntry->Flink;
|
||||||
|
@ -1848,6 +1905,13 @@ ScmAutoStartServices(VOID)
|
||||||
CurrentService->ServiceVisited = FALSE;
|
CurrentService->ServiceVisited = FALSE;
|
||||||
ServiceEntry = ServiceEntry->Flink;
|
ServiceEntry = ServiceEntry->Flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Release the service start lock, if needed, and the critical section */
|
||||||
|
if (Lock) ScmReleaseServiceStartLock(&Lock);
|
||||||
|
|
||||||
|
done:
|
||||||
|
LeaveCriticalSection(&ControlServiceCriticalSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2895,7 +2895,6 @@ DWORD RStartServiceW(
|
||||||
DWORD dwError = ERROR_SUCCESS;
|
DWORD dwError = ERROR_SUCCESS;
|
||||||
PSERVICE_HANDLE hSvc;
|
PSERVICE_HANDLE hSvc;
|
||||||
PSERVICE lpService = NULL;
|
PSERVICE lpService = NULL;
|
||||||
SC_RPC_LOCK Lock = NULL;
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
DWORD i;
|
DWORD i;
|
||||||
|
@ -2941,17 +2940,9 @@ DWORD RStartServiceW(
|
||||||
if (lpService->bDeleted)
|
if (lpService->bDeleted)
|
||||||
return ERROR_SERVICE_MARKED_FOR_DELETE;
|
return ERROR_SERVICE_MARKED_FOR_DELETE;
|
||||||
|
|
||||||
/* Acquire the service start lock until the service has been started */
|
|
||||||
dwError = ScmAcquireServiceStartLock(TRUE, &Lock);
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
|
||||||
return dwError;
|
|
||||||
|
|
||||||
/* Start the service */
|
/* Start the service */
|
||||||
dwError = ScmStartService(lpService, argc, (LPWSTR*)argv);
|
dwError = ScmStartService(lpService, argc, (LPWSTR*)argv);
|
||||||
|
|
||||||
/* Release the service start lock */
|
|
||||||
ScmReleaseServiceStartLock(&Lock);
|
|
||||||
|
|
||||||
return dwError;
|
return dwError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4171,7 +4162,6 @@ DWORD RStartServiceA(
|
||||||
DWORD dwError = ERROR_SUCCESS;
|
DWORD dwError = ERROR_SUCCESS;
|
||||||
PSERVICE_HANDLE hSvc;
|
PSERVICE_HANDLE hSvc;
|
||||||
PSERVICE lpService = NULL;
|
PSERVICE lpService = NULL;
|
||||||
SC_RPC_LOCK Lock = NULL;
|
|
||||||
LPWSTR *lpVector = NULL;
|
LPWSTR *lpVector = NULL;
|
||||||
DWORD i;
|
DWORD i;
|
||||||
DWORD dwLength;
|
DWORD dwLength;
|
||||||
|
@ -4244,17 +4234,9 @@ DWORD RStartServiceA(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Acquire the service start lock until the service has been started */
|
|
||||||
dwError = ScmAcquireServiceStartLock(TRUE, &Lock);
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
/* Start the service */
|
/* Start the service */
|
||||||
dwError = ScmStartService(lpService, argc, lpVector);
|
dwError = ScmStartService(lpService, argc, lpVector);
|
||||||
|
|
||||||
/* Release the service start lock */
|
|
||||||
ScmReleaseServiceStartLock(&Lock);
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
/* Free the Unicode argument vector */
|
/* Free the Unicode argument vector */
|
||||||
if (lpVector != NULL)
|
if (lpVector != NULL)
|
||||||
|
|
|
@ -22,6 +22,12 @@ int WINAPI RegisterServicesProcess(DWORD ServicesProcessId);
|
||||||
#define PIPE_BUFSIZE 1024
|
#define PIPE_BUFSIZE 1024
|
||||||
#define PIPE_TIMEOUT 1000
|
#define PIPE_TIMEOUT 1000
|
||||||
|
|
||||||
|
/* Defined in include/reactos/services/services.h */
|
||||||
|
// #define SCM_START_EVENT L"SvcctrlStartEvent_A3752DX"
|
||||||
|
#define SCM_AUTOSTARTCOMPLETE_EVENT L"SC_AutoStartComplete"
|
||||||
|
#define LSA_RPC_SERVER_ACTIVE L"LSA_RPC_SERVER_ACTIVE"
|
||||||
|
|
||||||
|
BOOL ScmInitialize = FALSE;
|
||||||
BOOL ScmShutdown = FALSE;
|
BOOL ScmShutdown = FALSE;
|
||||||
static HANDLE hScmShutdownEvent = NULL;
|
static HANDLE hScmShutdownEvent = NULL;
|
||||||
|
|
||||||
|
@ -77,35 +83,38 @@ ScmLogError(DWORD dwEventId,
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
ScmCreateStartEvent(PHANDLE StartEvent)
|
ScmCreateControlEvent(PHANDLE Event,
|
||||||
|
LPCWSTR Name,
|
||||||
|
DWORD dwDesiredAccess)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* This function creates a generic non-inheritable event
|
||||||
|
* and return a handle to the caller. The caller must
|
||||||
|
* close this handle afterwards.
|
||||||
|
*/
|
||||||
|
|
||||||
HANDLE hEvent;
|
HANDLE hEvent;
|
||||||
|
|
||||||
hEvent = CreateEventW(NULL,
|
hEvent = CreateEventW(NULL, TRUE, FALSE, Name);
|
||||||
TRUE,
|
|
||||||
FALSE,
|
|
||||||
L"SvcctrlStartEvent_A3752DX");
|
|
||||||
if (hEvent == NULL)
|
if (hEvent == NULL)
|
||||||
{
|
{
|
||||||
if (GetLastError() == ERROR_ALREADY_EXISTS)
|
if (GetLastError() == ERROR_ALREADY_EXISTS)
|
||||||
{
|
{
|
||||||
hEvent = OpenEventW(EVENT_ALL_ACCESS,
|
hEvent = OpenEventW(dwDesiredAccess, FALSE, Name);
|
||||||
FALSE,
|
|
||||||
L"SvcctrlStartEvent_A3752DX");
|
|
||||||
if (hEvent == NULL)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hEvent)
|
||||||
|
{
|
||||||
|
DPRINT("SERVICES: Created event %S with handle %x\n", Name, hEvent);
|
||||||
|
*Event = hEvent;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
DPRINT1("SERVICES: Failed to create event %S (Error %lu)\n", Name, GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
*StartEvent = hEvent;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,35 +122,21 @@ VOID
|
||||||
ScmWaitForLsa(VOID)
|
ScmWaitForLsa(VOID)
|
||||||
{
|
{
|
||||||
HANDLE hEvent;
|
HANDLE hEvent;
|
||||||
DWORD dwError;
|
|
||||||
|
|
||||||
hEvent = CreateEventW(NULL,
|
if (!ScmCreateControlEvent(&hEvent,
|
||||||
TRUE,
|
LSA_RPC_SERVER_ACTIVE,
|
||||||
FALSE,
|
SYNCHRONIZE))
|
||||||
L"LSA_RPC_SERVER_ACTIVE");
|
|
||||||
if (hEvent == NULL)
|
|
||||||
{
|
{
|
||||||
dwError = GetLastError();
|
DPRINT1("Failed to create the notification event (Error %lu)\n", GetLastError());
|
||||||
DPRINT1("Failed to create the notication event (Error %lu)\n", dwError);
|
}
|
||||||
|
else
|
||||||
if (dwError == ERROR_ALREADY_EXISTS)
|
|
||||||
{
|
{
|
||||||
hEvent = OpenEventW(SYNCHRONIZE,
|
|
||||||
FALSE,
|
|
||||||
L"LSA_RPC_SERVER_ACTIVE");
|
|
||||||
if (hEvent == NULL)
|
|
||||||
{
|
|
||||||
DPRINT1("Could not open the notification event (Error %lu)\n", GetLastError());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DPRINT("Wait for the LSA server!\n");
|
DPRINT("Wait for the LSA server!\n");
|
||||||
WaitForSingleObject(hEvent, INFINITE);
|
WaitForSingleObject(hEvent, INFINITE);
|
||||||
DPRINT("LSA server running!\n");
|
DPRINT("LSA server running!\n");
|
||||||
|
|
||||||
CloseHandle(hEvent);
|
CloseHandle(hEvent);
|
||||||
|
}
|
||||||
|
|
||||||
DPRINT("ScmWaitForLsa() done\n");
|
DPRINT("ScmWaitForLsa() done\n");
|
||||||
}
|
}
|
||||||
|
@ -351,23 +346,38 @@ wWinMain(HINSTANCE hInstance,
|
||||||
int nShowCmd)
|
int nShowCmd)
|
||||||
{
|
{
|
||||||
HANDLE hScmStartEvent = NULL;
|
HANDLE hScmStartEvent = NULL;
|
||||||
|
HANDLE hScmAutoStartCompleteEvent = NULL;
|
||||||
SC_RPC_LOCK Lock = NULL;
|
SC_RPC_LOCK Lock = NULL;
|
||||||
BOOL bCanDeleteNamedPipeCriticalSection = FALSE;
|
BOOL bCanDeleteNamedPipeCriticalSection = FALSE;
|
||||||
DWORD dwError;
|
DWORD dwError;
|
||||||
|
|
||||||
DPRINT("SERVICES: Service Control Manager\n");
|
DPRINT("SERVICES: Service Control Manager\n");
|
||||||
|
|
||||||
/* Create start event */
|
/* We are initializing ourselves */
|
||||||
if (!ScmCreateStartEvent(&hScmStartEvent))
|
ScmInitialize = TRUE;
|
||||||
|
|
||||||
|
/* Create the start event */
|
||||||
|
if (!ScmCreateControlEvent(&hScmStartEvent,
|
||||||
|
SCM_START_EVENT,
|
||||||
|
EVENT_ALL_ACCESS))
|
||||||
{
|
{
|
||||||
DPRINT1("SERVICES: Failed to create start event\n");
|
DPRINT1("SERVICES: Failed to create the start event\n");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
DPRINT("SERVICES: Created start event with handle %p.\n", hScmStartEvent);
|
||||||
|
|
||||||
DPRINT("SERVICES: created start event with handle %p.\n", hScmStartEvent);
|
/* Create the auto-start complete event */
|
||||||
|
if (!ScmCreateControlEvent(&hScmAutoStartCompleteEvent,
|
||||||
|
SCM_AUTOSTARTCOMPLETE_EVENT,
|
||||||
|
EVENT_ALL_ACCESS))
|
||||||
|
{
|
||||||
|
DPRINT1("SERVICES: Failed to create the auto-start complete event\n");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
DPRINT("SERVICES: created auto-start complete event with handle %p.\n", hScmAutoStartCompleteEvent);
|
||||||
|
|
||||||
/* Create the shutdown event */
|
/* Create the shutdown event */
|
||||||
hScmShutdownEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
hScmShutdownEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
|
||||||
if (hScmShutdownEvent == NULL)
|
if (hScmShutdownEvent == NULL)
|
||||||
{
|
{
|
||||||
DPRINT1("SERVICES: Failed to create shutdown event\n");
|
DPRINT1("SERVICES: Failed to create shutdown event\n");
|
||||||
|
@ -385,7 +395,7 @@ wWinMain(HINSTANCE hInstance,
|
||||||
/* Read the control set values */
|
/* Read the control set values */
|
||||||
if (!ScmGetControlSetValues())
|
if (!ScmGetControlSetValues())
|
||||||
{
|
{
|
||||||
DPRINT1("SERVICES: failed to read the control set values\n");
|
DPRINT1("SERVICES: Failed to read the control set values\n");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,50 +403,59 @@ wWinMain(HINSTANCE hInstance,
|
||||||
dwError = ScmCreateServiceDatabase();
|
dwError = ScmCreateServiceDatabase();
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT1("SERVICES: failed to create SCM database (Error %lu)\n", dwError);
|
DPRINT1("SERVICES: Failed to create SCM database (Error %lu)\n", dwError);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Wait for the LSA server */
|
||||||
|
ScmWaitForLsa();
|
||||||
|
|
||||||
/* Update the services database */
|
/* Update the services database */
|
||||||
ScmGetBootAndSystemDriverState();
|
ScmGetBootAndSystemDriverState();
|
||||||
|
|
||||||
/* Register the Service Control Manager process with CSRSS */
|
/* Register the Service Control Manager process with the ReactOS Subsystem */
|
||||||
if (!RegisterServicesProcess(GetCurrentProcessId()))
|
if (!RegisterServicesProcess(GetCurrentProcessId()))
|
||||||
{
|
{
|
||||||
DPRINT1("SERVICES: Could not register SCM process\n");
|
DPRINT1("SERVICES: Could not register SCM process\n");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Acquire the service start lock until autostart services have been started */
|
/*
|
||||||
|
* Acquire the user service start lock until
|
||||||
|
* auto-start services have been started.
|
||||||
|
*/
|
||||||
dwError = ScmAcquireServiceStartLock(TRUE, &Lock);
|
dwError = ScmAcquireServiceStartLock(TRUE, &Lock);
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT1("SERVICES: failed to acquire the service start lock (Error %lu)\n", dwError);
|
DPRINT1("SERVICES: Failed to acquire the service start lock (Error %lu)\n", dwError);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start the RPC server */
|
/* Start the RPC server */
|
||||||
ScmStartRpcServer();
|
ScmStartRpcServer();
|
||||||
|
|
||||||
DPRINT("SERVICES: Initialized.\n");
|
|
||||||
|
|
||||||
/* Signal start event */
|
/* Signal start event */
|
||||||
SetEvent(hScmStartEvent);
|
SetEvent(hScmStartEvent);
|
||||||
|
|
||||||
|
DPRINT("SERVICES: Initialized.\n");
|
||||||
|
|
||||||
/* Register event handler (used for system shutdown) */
|
/* Register event handler (used for system shutdown) */
|
||||||
SetConsoleCtrlHandler(ShutdownHandlerRoutine, TRUE);
|
SetConsoleCtrlHandler(ShutdownHandlerRoutine, TRUE);
|
||||||
|
|
||||||
/* Wait for the LSA server */
|
|
||||||
ScmWaitForLsa();
|
|
||||||
|
|
||||||
/* Start auto-start services */
|
/* Start auto-start services */
|
||||||
ScmAutoStartServices();
|
ScmAutoStartServices();
|
||||||
|
|
||||||
|
/* Signal auto-start complete event */
|
||||||
|
SetEvent(hScmAutoStartCompleteEvent);
|
||||||
|
|
||||||
/* FIXME: more to do ? */
|
/* FIXME: more to do ? */
|
||||||
|
|
||||||
/* Release the service start lock */
|
/* Release the service start lock */
|
||||||
ScmReleaseServiceStartLock(&Lock);
|
ScmReleaseServiceStartLock(&Lock);
|
||||||
|
|
||||||
|
/* Initialization finished */
|
||||||
|
ScmInitialize = FALSE;
|
||||||
|
|
||||||
DPRINT("SERVICES: Running.\n");
|
DPRINT("SERVICES: Running.\n");
|
||||||
|
|
||||||
/* Wait until the shutdown event gets signaled */
|
/* Wait until the shutdown event gets signaled */
|
||||||
|
@ -451,6 +470,10 @@ done:
|
||||||
if (hScmShutdownEvent != NULL)
|
if (hScmShutdownEvent != NULL)
|
||||||
CloseHandle(hScmShutdownEvent);
|
CloseHandle(hScmShutdownEvent);
|
||||||
|
|
||||||
|
/* Close the auto-start complete event */
|
||||||
|
if (hScmAutoStartCompleteEvent != NULL)
|
||||||
|
CloseHandle(hScmAutoStartCompleteEvent);
|
||||||
|
|
||||||
/* Close the start event */
|
/* Close the start event */
|
||||||
if (hScmStartEvent != NULL)
|
if (hScmStartEvent != NULL)
|
||||||
CloseHandle(hScmStartEvent);
|
CloseHandle(hScmStartEvent);
|
||||||
|
@ -458,7 +481,6 @@ done:
|
||||||
DPRINT("SERVICES: Finished.\n");
|
DPRINT("SERVICES: Finished.\n");
|
||||||
|
|
||||||
ExitThread(0);
|
ExitThread(0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,7 @@ typedef struct _START_LOCK
|
||||||
extern LIST_ENTRY ServiceListHead;
|
extern LIST_ENTRY ServiceListHead;
|
||||||
extern LIST_ENTRY GroupListHead;
|
extern LIST_ENTRY GroupListHead;
|
||||||
extern LIST_ENTRY ImageListHead;
|
extern LIST_ENTRY ImageListHead;
|
||||||
|
extern BOOL ScmInitialize;
|
||||||
extern BOOL ScmShutdown;
|
extern BOOL ScmShutdown;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -127,11 +127,11 @@ CUSBHardwareDevice::QueryInterface(
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
LPCWSTR
|
LPCSTR
|
||||||
STDMETHODCALLTYPE
|
STDMETHODCALLTYPE
|
||||||
CUSBHardwareDevice::GetUSBType()
|
CUSBHardwareDevice::GetUSBType()
|
||||||
{
|
{
|
||||||
return L"USBEHCI";
|
return "USBEHCI";
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
|
|
@ -124,11 +124,11 @@ CUSBHardwareDevice::QueryInterface(
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
LPCWSTR
|
LPCSTR
|
||||||
STDMETHODCALLTYPE
|
STDMETHODCALLTYPE
|
||||||
CUSBHardwareDevice::GetUSBType()
|
CUSBHardwareDevice::GetUSBType()
|
||||||
{
|
{
|
||||||
return L"USBOHCI";
|
return "USBOHCI";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -145,11 +145,11 @@ CUSBHardwareDevice::QueryInterface(
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
LPCWSTR
|
LPCSTR
|
||||||
STDMETHODCALLTYPE
|
STDMETHODCALLTYPE
|
||||||
CUSBHardwareDevice::GetUSBType()
|
CUSBHardwareDevice::GetUSBType()
|
||||||
{
|
{
|
||||||
return L"USBUHCI";
|
return "USBUHCI";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,7 @@ struct IUSBQueue;
|
||||||
IN PVOID CallBack, \
|
IN PVOID CallBack, \
|
||||||
IN PVOID Context) PURE; \
|
IN PVOID Context) PURE; \
|
||||||
\
|
\
|
||||||
STDMETHOD_(LPCWSTR, GetUSBType)(THIS) PURE;
|
STDMETHOD_(LPCSTR, GetUSBType)(THIS) PURE;
|
||||||
|
|
||||||
|
|
||||||
#define IMP_IUSBHARDWAREDEVICE \
|
#define IMP_IUSBHARDWAREDEVICE \
|
||||||
|
@ -232,7 +232,7 @@ struct IUSBQueue;
|
||||||
IN PVOID CallBack, \
|
IN PVOID CallBack, \
|
||||||
IN PVOID Context); \
|
IN PVOID Context); \
|
||||||
\
|
\
|
||||||
STDMETHODIMP_(LPCWSTR) GetUSBType();
|
STDMETHODIMP_(LPCSTR) GetUSBType();
|
||||||
|
|
||||||
DECLARE_INTERFACE_(IUSBHardwareDevice, IUnknown)
|
DECLARE_INTERFACE_(IUSBHardwareDevice, IUnknown)
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,7 +60,7 @@ protected:
|
||||||
PUSBHARDWAREDEVICE m_Hardware;
|
PUSBHARDWAREDEVICE m_Hardware;
|
||||||
PHUBCONTROLLER m_HubController;
|
PHUBCONTROLLER m_HubController;
|
||||||
ULONG m_FDODeviceNumber;
|
ULONG m_FDODeviceNumber;
|
||||||
LPCWSTR m_USBType;
|
LPCSTR m_USBType;
|
||||||
};
|
};
|
||||||
|
|
||||||
//=================================================================================================
|
//=================================================================================================
|
||||||
|
@ -138,7 +138,7 @@ CHCDController::Initialize(
|
||||||
Status = m_Hardware->Initialize(m_DriverObject, m_FunctionalDeviceObject, m_PhysicalDeviceObject, m_NextDeviceObject);
|
Status = m_Hardware->Initialize(m_DriverObject, m_FunctionalDeviceObject, m_PhysicalDeviceObject, m_NextDeviceObject);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] Failed to initialize hardware object %x\n", m_Hardware->GetUSBType(), Status);
|
DPRINT1("[%s] Failed to initialize hardware object %x\n", m_Hardware->GetUSBType(), Status);
|
||||||
|
|
||||||
//
|
//
|
||||||
// failed to initialize hardware object, detach from device stack
|
// failed to initialize hardware object, detach from device stack
|
||||||
|
@ -240,7 +240,7 @@ CHCDController::HandleDeviceControl(
|
||||||
//
|
//
|
||||||
PC_ASSERT(DeviceExtension->IsFDO);
|
PC_ASSERT(DeviceExtension->IsFDO);
|
||||||
|
|
||||||
DPRINT1("[%S] HandleDeviceControl>Type: IoCtl %x InputBufferLength %lu OutputBufferLength %lu\n", m_USBType,
|
DPRINT1("[%s] HandleDeviceControl>Type: IoCtl %x InputBufferLength %lu OutputBufferLength %lu\n", m_USBType,
|
||||||
IoStack->Parameters.DeviceIoControl.IoControlCode,
|
IoStack->Parameters.DeviceIoControl.IoControlCode,
|
||||||
IoStack->Parameters.DeviceIoControl.InputBufferLength,
|
IoStack->Parameters.DeviceIoControl.InputBufferLength,
|
||||||
IoStack->Parameters.DeviceIoControl.OutputBufferLength);
|
IoStack->Parameters.DeviceIoControl.OutputBufferLength);
|
||||||
|
@ -285,7 +285,7 @@ CHCDController::HandleDeviceControl(
|
||||||
//
|
//
|
||||||
// informal debug print
|
// informal debug print
|
||||||
//
|
//
|
||||||
DPRINT1("[%S] Result %S\n", m_USBType, DriverKey->DriverKeyName);
|
DPRINT1("[%s] Result %S\n", m_USBType, DriverKey->DriverKeyName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,7 +337,7 @@ CHCDController::HandleDeviceControl(
|
||||||
PC_ASSERT(IoStack->Parameters.DeviceIoControl.OutputBufferLength - sizeof(ULONG) - sizeof(WCHAR) >= ResultLength);
|
PC_ASSERT(IoStack->Parameters.DeviceIoControl.OutputBufferLength - sizeof(ULONG) - sizeof(WCHAR) >= ResultLength);
|
||||||
|
|
||||||
DriverKey->DriverKeyName[ResultLength / sizeof(WCHAR)] = L'\0';
|
DriverKey->DriverKeyName[ResultLength / sizeof(WCHAR)] = L'\0';
|
||||||
DPRINT1("[%S] Result %S\n", m_USBType, DriverKey->DriverKeyName);
|
DPRINT1("[%s] Result %S\n", m_USBType, DriverKey->DriverKeyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -400,7 +400,7 @@ CHCDController::HandlePnp(
|
||||||
{
|
{
|
||||||
case IRP_MN_START_DEVICE:
|
case IRP_MN_START_DEVICE:
|
||||||
{
|
{
|
||||||
DPRINT("[%S] HandlePnp IRP_MN_START FDO\n", m_USBType);
|
DPRINT("[%s] HandlePnp IRP_MN_START FDO\n", m_USBType);
|
||||||
|
|
||||||
//
|
//
|
||||||
// first start lower device object
|
// first start lower device object
|
||||||
|
@ -429,12 +429,12 @@ CHCDController::HandlePnp(
|
||||||
Status = SetSymbolicLink(TRUE);
|
Status = SetSymbolicLink(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("[%S] HandlePnp IRP_MN_START FDO: Status %x\n", m_USBType ,Status);
|
DPRINT("[%s] HandlePnp IRP_MN_START FDO: Status %x\n", m_USBType ,Status);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IRP_MN_QUERY_DEVICE_RELATIONS:
|
case IRP_MN_QUERY_DEVICE_RELATIONS:
|
||||||
{
|
{
|
||||||
DPRINT("[%S] HandlePnp IRP_MN_QUERY_DEVICE_RELATIONS Type %lx\n", m_USBType, IoStack->Parameters.QueryDeviceRelations.Type);
|
DPRINT("[%s] HandlePnp IRP_MN_QUERY_DEVICE_RELATIONS Type %lx\n", m_USBType, IoStack->Parameters.QueryDeviceRelations.Type);
|
||||||
|
|
||||||
if (m_HubController == NULL)
|
if (m_HubController == NULL)
|
||||||
{
|
{
|
||||||
|
@ -514,7 +514,7 @@ CHCDController::HandlePnp(
|
||||||
}
|
}
|
||||||
case IRP_MN_STOP_DEVICE:
|
case IRP_MN_STOP_DEVICE:
|
||||||
{
|
{
|
||||||
DPRINT("[%S] HandlePnp IRP_MN_STOP_DEVICE\n", m_USBType);
|
DPRINT("[%s] HandlePnp IRP_MN_STOP_DEVICE\n", m_USBType);
|
||||||
|
|
||||||
if (m_Hardware)
|
if (m_Hardware)
|
||||||
{
|
{
|
||||||
|
@ -555,7 +555,7 @@ CHCDController::HandlePnp(
|
||||||
IoSkipCurrentIrpStackLocation(Irp);
|
IoSkipCurrentIrpStackLocation(Irp);
|
||||||
return IoCallDriver(m_NextDeviceObject, Irp);
|
return IoCallDriver(m_NextDeviceObject, Irp);
|
||||||
#else
|
#else
|
||||||
DPRINT1("[%S] Denying controller removal due to reinitialization bugs\n", m_USBType);
|
DPRINT1("[%s] Denying controller removal due to reinitialization bugs\n", m_USBType);
|
||||||
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
@ -563,7 +563,7 @@ CHCDController::HandlePnp(
|
||||||
}
|
}
|
||||||
case IRP_MN_REMOVE_DEVICE:
|
case IRP_MN_REMOVE_DEVICE:
|
||||||
{
|
{
|
||||||
DPRINT("[%S] HandlePnp IRP_MN_REMOVE_DEVICE FDO\n", m_USBType);
|
DPRINT("[%s] HandlePnp IRP_MN_REMOVE_DEVICE FDO\n", m_USBType);
|
||||||
|
|
||||||
//
|
//
|
||||||
// delete the symbolic link
|
// delete the symbolic link
|
||||||
|
@ -676,7 +676,7 @@ CHCDController::CreateFDO(
|
||||||
//
|
//
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] CreateFDO: Failed to create %wZ, Status %x\n", m_USBType, &DeviceName, Status);
|
DPRINT1("[%s] CreateFDO: Failed to create %wZ, Status %x\n", m_USBType, &DeviceName, Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -686,7 +686,7 @@ CHCDController::CreateFDO(
|
||||||
//
|
//
|
||||||
m_FDODeviceNumber = UsbDeviceNumber;
|
m_FDODeviceNumber = UsbDeviceNumber;
|
||||||
|
|
||||||
DPRINT("[%S] CreateFDO: DeviceName %wZ\n", m_USBType, &DeviceName);
|
DPRINT("[%s] CreateFDO: DeviceName %wZ\n", m_USBType, &DeviceName);
|
||||||
|
|
||||||
/* done */
|
/* done */
|
||||||
return Status;
|
return Status;
|
||||||
|
|
|
@ -105,7 +105,7 @@ protected:
|
||||||
PULONG m_DeviceAddressBitmapBuffer;
|
PULONG m_DeviceAddressBitmapBuffer;
|
||||||
LIST_ENTRY m_UsbDeviceList;
|
LIST_ENTRY m_UsbDeviceList;
|
||||||
PIRP m_PendingSCEIrp;
|
PIRP m_PendingSCEIrp;
|
||||||
LPCWSTR m_USBType;
|
LPCSTR m_USBType;
|
||||||
|
|
||||||
|
|
||||||
//Internal Functions
|
//Internal Functions
|
||||||
|
@ -310,7 +310,7 @@ CHubController::QueryStatusChageEndpoint(
|
||||||
// Get the number of ports and check each one for device connected
|
// Get the number of ports and check each one for device connected
|
||||||
//
|
//
|
||||||
m_Hardware->GetDeviceDetails(NULL, NULL, &PortCount, NULL);
|
m_Hardware->GetDeviceDetails(NULL, NULL, &PortCount, NULL);
|
||||||
DPRINT1("[%S] SCE Request %p TransferBufferLength %lu Flags %x MDL %p\n", m_USBType, Urb->UrbBulkOrInterruptTransfer.TransferBuffer, Urb->UrbBulkOrInterruptTransfer.TransferBufferLength, Urb->UrbBulkOrInterruptTransfer.TransferFlags, Urb->UrbBulkOrInterruptTransfer.TransferBufferMDL);
|
DPRINT1("[%s] SCE Request %p TransferBufferLength %lu Flags %x MDL %p\n", m_USBType, Urb->UrbBulkOrInterruptTransfer.TransferBuffer, Urb->UrbBulkOrInterruptTransfer.TransferBufferLength, Urb->UrbBulkOrInterruptTransfer.TransferFlags, Urb->UrbBulkOrInterruptTransfer.TransferBufferMDL);
|
||||||
|
|
||||||
TransferBuffer = (PUCHAR)Urb->UrbBulkOrInterruptTransfer.TransferBuffer;
|
TransferBuffer = (PUCHAR)Urb->UrbBulkOrInterruptTransfer.TransferBuffer;
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ CHubController::QueryStatusChageEndpoint(
|
||||||
{
|
{
|
||||||
m_Hardware->GetPortStatus(PortId, &PortStatus, &PortChange);
|
m_Hardware->GetPortStatus(PortId, &PortStatus, &PortChange);
|
||||||
|
|
||||||
DPRINT1("[%S] Port %d: Status %x, Change %x\n", m_USBType, PortId, PortStatus, PortChange);
|
DPRINT1("[%s] Port %d: Status %x, Change %x\n", m_USBType, PortId, PortStatus, PortChange);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -329,7 +329,7 @@ CHubController::QueryStatusChageEndpoint(
|
||||||
//
|
//
|
||||||
if (PortChange != 0)
|
if (PortChange != 0)
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] Change state on port %d\n", m_USBType, PortId);
|
DPRINT1("[%s] Change state on port %d\n", m_USBType, PortId);
|
||||||
// Set the value for the port number
|
// Set the value for the port number
|
||||||
*TransferBuffer = 1 << ((PortId + 1) & 7);
|
*TransferBuffer = 1 << ((PortId + 1) & 7);
|
||||||
Changed = TRUE;
|
Changed = TRUE;
|
||||||
|
@ -432,7 +432,7 @@ CHubController::HandlePnp(
|
||||||
{
|
{
|
||||||
case IRP_MN_START_DEVICE:
|
case IRP_MN_START_DEVICE:
|
||||||
{
|
{
|
||||||
DPRINT("[%S] HandlePnp IRP_MN_START_DEVICE\n", m_USBType);
|
DPRINT("[%s] HandlePnp IRP_MN_START_DEVICE\n", m_USBType);
|
||||||
//
|
//
|
||||||
// register device interface
|
// register device interface
|
||||||
//
|
//
|
||||||
|
@ -450,7 +450,7 @@ CHubController::HandlePnp(
|
||||||
}
|
}
|
||||||
case IRP_MN_QUERY_ID:
|
case IRP_MN_QUERY_ID:
|
||||||
{
|
{
|
||||||
DPRINT("[%S] HandlePnp IRP_MN_QUERY_ID Type %x\n", m_USBType, IoStack->Parameters.QueryId.IdType);
|
DPRINT("[%s] HandlePnp IRP_MN_QUERY_ID Type %x\n", m_USBType, IoStack->Parameters.QueryId.IdType);
|
||||||
|
|
||||||
if (IoStack->Parameters.QueryId.IdType == BusQueryDeviceID)
|
if (IoStack->Parameters.QueryId.IdType == BusQueryDeviceID)
|
||||||
{
|
{
|
||||||
|
@ -525,7 +525,7 @@ CHubController::HandlePnp(
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] HandlePnp> failed to get hardware id %x\n", m_USBType, Status);
|
DPRINT1("[%s] HandlePnp> failed to get hardware id %x\n", m_USBType, Status);
|
||||||
VendorID = 0x8086;
|
VendorID = 0x8086;
|
||||||
DeviceID = 0x3A37;
|
DeviceID = 0x3A37;
|
||||||
}
|
}
|
||||||
|
@ -553,7 +553,7 @@ CHubController::HandlePnp(
|
||||||
Index++;
|
Index++;
|
||||||
|
|
||||||
|
|
||||||
DPRINT1("[%S] Name %S\n", m_USBType, Buffer);
|
DPRINT1("[%s] Name %S\n", m_USBType, Buffer);
|
||||||
|
|
||||||
//
|
//
|
||||||
// allocate buffer
|
// allocate buffer
|
||||||
|
@ -587,7 +587,7 @@ CHubController::HandlePnp(
|
||||||
}
|
}
|
||||||
case IRP_MN_QUERY_CAPABILITIES:
|
case IRP_MN_QUERY_CAPABILITIES:
|
||||||
{
|
{
|
||||||
DPRINT("[%S] HandlePnp IRP_MN_QUERY_CAPABILITIES\n", m_USBType);
|
DPRINT("[%s] HandlePnp IRP_MN_QUERY_CAPABILITIES\n", m_USBType);
|
||||||
|
|
||||||
DeviceCapabilities = (PDEVICE_CAPABILITIES)IoStack->Parameters.DeviceCapabilities.Capabilities;
|
DeviceCapabilities = (PDEVICE_CAPABILITIES)IoStack->Parameters.DeviceCapabilities.Capabilities;
|
||||||
|
|
||||||
|
@ -619,7 +619,7 @@ CHubController::HandlePnp(
|
||||||
}
|
}
|
||||||
case IRP_MN_QUERY_INTERFACE:
|
case IRP_MN_QUERY_INTERFACE:
|
||||||
{
|
{
|
||||||
DPRINT("[%S] HandlePnp IRP_MN_QUERY_INTERFACE\n", m_USBType);
|
DPRINT("[%s] HandlePnp IRP_MN_QUERY_INTERFACE\n", m_USBType);
|
||||||
|
|
||||||
//
|
//
|
||||||
// handle device interface requests
|
// handle device interface requests
|
||||||
|
@ -629,7 +629,7 @@ CHubController::HandlePnp(
|
||||||
}
|
}
|
||||||
case IRP_MN_REMOVE_DEVICE:
|
case IRP_MN_REMOVE_DEVICE:
|
||||||
{
|
{
|
||||||
DPRINT("[%S] HandlePnp IRP_MN_REMOVE_DEVICE\n", m_USBType);
|
DPRINT("[%s] HandlePnp IRP_MN_REMOVE_DEVICE\n", m_USBType);
|
||||||
|
|
||||||
//
|
//
|
||||||
// deactivate device interface for BUS PDO
|
// deactivate device interface for BUS PDO
|
||||||
|
@ -659,7 +659,7 @@ CHubController::HandlePnp(
|
||||||
}
|
}
|
||||||
case IRP_MN_QUERY_DEVICE_RELATIONS:
|
case IRP_MN_QUERY_DEVICE_RELATIONS:
|
||||||
{
|
{
|
||||||
DPRINT("[%S] HandlePnp IRP_MN_QUERY_DEVICE_RELATIONS Type %x\n", m_USBType, IoStack->Parameters.QueryDeviceRelations.Type);
|
DPRINT("[%s] HandlePnp IRP_MN_QUERY_DEVICE_RELATIONS Type %x\n", m_USBType, IoStack->Parameters.QueryDeviceRelations.Type);
|
||||||
|
|
||||||
if (IoStack->Parameters.QueryDeviceRelations.Type == TargetDeviceRelation)
|
if (IoStack->Parameters.QueryDeviceRelations.Type == TargetDeviceRelation)
|
||||||
{
|
{
|
||||||
|
@ -700,7 +700,7 @@ CHubController::HandlePnp(
|
||||||
}
|
}
|
||||||
case IRP_MN_QUERY_BUS_INFORMATION:
|
case IRP_MN_QUERY_BUS_INFORMATION:
|
||||||
{
|
{
|
||||||
DPRINT("[%S] HandlePnp IRP_MN_QUERY_BUS_INFORMATION\n", m_USBType);
|
DPRINT("[%s] HandlePnp IRP_MN_QUERY_BUS_INFORMATION\n", m_USBType);
|
||||||
|
|
||||||
//
|
//
|
||||||
// allocate buffer for bus information
|
// allocate buffer for bus information
|
||||||
|
@ -733,7 +733,7 @@ CHubController::HandlePnp(
|
||||||
}
|
}
|
||||||
case IRP_MN_STOP_DEVICE:
|
case IRP_MN_STOP_DEVICE:
|
||||||
{
|
{
|
||||||
DPRINT("[%S] HandlePnp IRP_MN_STOP_DEVICE\n", m_USBType);
|
DPRINT("[%s] HandlePnp IRP_MN_STOP_DEVICE\n", m_USBType);
|
||||||
//
|
//
|
||||||
// stop device
|
// stop device
|
||||||
//
|
//
|
||||||
|
@ -742,7 +742,7 @@ CHubController::HandlePnp(
|
||||||
}
|
}
|
||||||
case IRP_MN_SURPRISE_REMOVAL:
|
case IRP_MN_SURPRISE_REMOVAL:
|
||||||
{
|
{
|
||||||
DPRINT("[%S] HandlePnp IRP_MN_SURPRISE_REMOVAL\n", m_USBType);
|
DPRINT("[%s] HandlePnp IRP_MN_SURPRISE_REMOVAL\n", m_USBType);
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -796,7 +796,7 @@ CHubController::HandleIsochronousTransfer(
|
||||||
|
|
||||||
if (!EndPointDesc)
|
if (!EndPointDesc)
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] Error No EndpointDesc\n", m_USBType);
|
DPRINT1("[%s] Error No EndpointDesc\n", m_USBType);
|
||||||
Urb->UrbIsochronousTransfer.Hdr.Status = USBD_STATUS_INVALID_PIPE_HANDLE;
|
Urb->UrbIsochronousTransfer.Hdr.Status = USBD_STATUS_INVALID_PIPE_HANDLE;
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
@ -805,7 +805,7 @@ CHubController::HandleIsochronousTransfer(
|
||||||
// sanity checks
|
// sanity checks
|
||||||
//
|
//
|
||||||
ASSERT(EndPointDesc);
|
ASSERT(EndPointDesc);
|
||||||
DPRINT("[%S] HandleIsochronousTransfer EndPointDesc %p Address %x bmAttributes %x\n", m_USBType, EndPointDesc, EndPointDesc->bEndpointAddress, EndPointDesc->bmAttributes);
|
DPRINT("[%s] HandleIsochronousTransfer EndPointDesc %p Address %x bmAttributes %x\n", m_USBType, EndPointDesc, EndPointDesc->bEndpointAddress, EndPointDesc->bmAttributes);
|
||||||
ASSERT((EndPointDesc->bmAttributes & USB_ENDPOINT_TYPE_MASK) == USB_ENDPOINT_TYPE_ISOCHRONOUS);
|
ASSERT((EndPointDesc->bmAttributes & USB_ENDPOINT_TYPE_MASK) == USB_ENDPOINT_TYPE_ISOCHRONOUS);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -813,7 +813,7 @@ CHubController::HandleIsochronousTransfer(
|
||||||
//
|
//
|
||||||
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] HandleIsochronousTransfer invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
DPRINT1("[%s] HandleIsochronousTransfer invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
||||||
|
|
||||||
//
|
//
|
||||||
// invalid device handle
|
// invalid device handle
|
||||||
|
@ -856,7 +856,7 @@ CHubController::HandleBulkOrInterruptTransfer(
|
||||||
//
|
//
|
||||||
// Else pend the IRP, to be completed when a device connects or disconnects.
|
// Else pend the IRP, to be completed when a device connects or disconnects.
|
||||||
//
|
//
|
||||||
DPRINT("[%S] Pending SCE Irp\n", m_USBType);
|
DPRINT("[%s] Pending SCE Irp\n", m_USBType);
|
||||||
m_PendingSCEIrp = Irp;
|
m_PendingSCEIrp = Irp;
|
||||||
IoMarkIrpPending(Irp);
|
IoMarkIrpPending(Irp);
|
||||||
return STATUS_PENDING;
|
return STATUS_PENDING;
|
||||||
|
@ -878,7 +878,7 @@ CHubController::HandleBulkOrInterruptTransfer(
|
||||||
//
|
//
|
||||||
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] HandleBulkOrInterruptTransfer invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
DPRINT1("[%s] HandleBulkOrInterruptTransfer invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
||||||
|
|
||||||
//
|
//
|
||||||
// invalid device handle
|
// invalid device handle
|
||||||
|
@ -905,7 +905,7 @@ CHubController::HandleClassOther(
|
||||||
ULONG NumPort;
|
ULONG NumPort;
|
||||||
ULONG PortId;
|
ULONG PortId;
|
||||||
|
|
||||||
DPRINT("[%S] HandleClassOther> Request %x Value %x\n", m_USBType, Urb->UrbControlVendorClassRequest.Request, Urb->UrbControlVendorClassRequest.Value);
|
DPRINT("[%s] HandleClassOther> Request %x Value %x\n", m_USBType, Urb->UrbControlVendorClassRequest.Request, Urb->UrbControlVendorClassRequest.Value);
|
||||||
|
|
||||||
//
|
//
|
||||||
// get number of ports available
|
// get number of ports available
|
||||||
|
@ -947,7 +947,7 @@ CHubController::HandleClassOther(
|
||||||
//
|
//
|
||||||
// request contains buffer of 2 ushort which are used from submitting port status and port change status
|
// request contains buffer of 2 ushort which are used from submitting port status and port change status
|
||||||
//
|
//
|
||||||
DPRINT("[%S] PortId %x PortStatus %x PortChange %x\n", m_USBType, PortId, PortStatus, PortChange);
|
DPRINT("[%s] PortId %x PortStatus %x PortChange %x\n", m_USBType, PortId, PortStatus, PortChange);
|
||||||
Buffer = (PUSHORT)Urb->UrbControlVendorClassRequest.TransferBuffer;
|
Buffer = (PUSHORT)Urb->UrbControlVendorClassRequest.TransferBuffer;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -974,7 +974,7 @@ CHubController::HandleClassOther(
|
||||||
Status = m_Hardware->ClearPortStatus(PortId, C_PORT_RESET);
|
Status = m_Hardware->ClearPortStatus(PortId, C_PORT_RESET);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DPRINT("[%S] Unknown Value for Clear Feature %x \n", m_USBType, Urb->UrbControlVendorClassRequest.Value);
|
DPRINT("[%s] Unknown Value for Clear Feature %x \n", m_USBType, Urb->UrbControlVendorClassRequest.Value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1023,13 +1023,13 @@ CHubController::HandleClassOther(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
DPRINT1("[%S] Unsupported request id %x\n", m_USBType, Urb->UrbControlVendorClassRequest.Value);
|
DPRINT1("[%s] Unsupported request id %x\n", m_USBType, Urb->UrbControlVendorClassRequest.Value);
|
||||||
PC_ASSERT(FALSE);
|
PC_ASSERT(FALSE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
DPRINT1("[%S] HandleClassOther Unknown request code %x\n", m_USBType, Urb->UrbControlVendorClassRequest.Request);
|
DPRINT1("[%s] HandleClassOther Unknown request code %x\n", m_USBType, Urb->UrbControlVendorClassRequest.Request);
|
||||||
PC_ASSERT(0);
|
PC_ASSERT(0);
|
||||||
Status = STATUS_INVALID_DEVICE_REQUEST;
|
Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||||
}
|
}
|
||||||
|
@ -1095,7 +1095,7 @@ CHubController::HandleSelectConfiguration(
|
||||||
//
|
//
|
||||||
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] HandleSelectConfiguration invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
DPRINT1("[%s] HandleSelectConfiguration invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
||||||
|
|
||||||
//
|
//
|
||||||
// invalid device handle
|
// invalid device handle
|
||||||
|
@ -1151,7 +1151,7 @@ CHubController::HandleSelectInterface(
|
||||||
//
|
//
|
||||||
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] HandleSelectInterface invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
DPRINT1("[%s] HandleSelectInterface invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
||||||
|
|
||||||
//
|
//
|
||||||
// invalid device handle
|
// invalid device handle
|
||||||
|
@ -1208,7 +1208,7 @@ CHubController::HandleGetStatusFromDevice(
|
||||||
//
|
//
|
||||||
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] HandleGetStatusFromDevice invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
DPRINT1("[%s] HandleGetStatusFromDevice invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
||||||
|
|
||||||
//
|
//
|
||||||
// invalid device handle
|
// invalid device handle
|
||||||
|
@ -1252,7 +1252,7 @@ CHubController::HandleGetStatusFromDevice(
|
||||||
//
|
//
|
||||||
Status = UsbDevice->SubmitSetupPacket(&CtrlSetup, Urb->UrbControlDescriptorRequest.TransferBufferLength, Urb->UrbControlDescriptorRequest.TransferBuffer);
|
Status = UsbDevice->SubmitSetupPacket(&CtrlSetup, Urb->UrbControlDescriptorRequest.TransferBufferLength, Urb->UrbControlDescriptorRequest.TransferBuffer);
|
||||||
ASSERT(Status == STATUS_SUCCESS);
|
ASSERT(Status == STATUS_SUCCESS);
|
||||||
DPRINT1("[%S] HandleGetStatusFromDevice Status %x Length %lu DeviceStatus %x\n", m_USBType, Status, Urb->UrbControlDescriptorRequest.TransferBufferLength, *DeviceStatus);
|
DPRINT1("[%s] HandleGetStatusFromDevice Status %x Length %lu DeviceStatus %x\n", m_USBType, Status, Urb->UrbControlDescriptorRequest.TransferBufferLength, *DeviceStatus);
|
||||||
|
|
||||||
//
|
//
|
||||||
// done
|
// done
|
||||||
|
@ -1273,7 +1273,7 @@ CHubController::HandleClassDevice(
|
||||||
PUSBDEVICE UsbDevice;
|
PUSBDEVICE UsbDevice;
|
||||||
USB_DEFAULT_PIPE_SETUP_PACKET CtrlSetup;
|
USB_DEFAULT_PIPE_SETUP_PACKET CtrlSetup;
|
||||||
|
|
||||||
DPRINT("[%S] HandleClassDevice Request %x Class %x\n", m_USBType, Urb->UrbControlVendorClassRequest.Request, Urb->UrbControlVendorClassRequest.Value >> 8);
|
DPRINT("[%s] HandleClassDevice Request %x Class %x\n", m_USBType, Urb->UrbControlVendorClassRequest.Request, Urb->UrbControlVendorClassRequest.Value >> 8);
|
||||||
|
|
||||||
//
|
//
|
||||||
// check class request type
|
// check class request type
|
||||||
|
@ -1287,7 +1287,7 @@ CHubController::HandleClassDevice(
|
||||||
//
|
//
|
||||||
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] HandleClassDevice invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
DPRINT1("[%s] HandleClassDevice invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
||||||
|
|
||||||
//
|
//
|
||||||
// invalid device handle
|
// invalid device handle
|
||||||
|
@ -1371,7 +1371,7 @@ CHubController::HandleClassDevice(
|
||||||
{
|
{
|
||||||
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] HandleClassDevice invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
DPRINT1("[%s] HandleClassDevice invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
||||||
//
|
//
|
||||||
// invalid device handle
|
// invalid device handle
|
||||||
//
|
//
|
||||||
|
@ -1387,7 +1387,7 @@ CHubController::HandleClassDevice(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
DPRINT1("[%S] HandleClassDevice Class %x not implemented\n", m_USBType, Urb->UrbControlVendorClassRequest.Value >> 8);
|
DPRINT1("[%s] HandleClassDevice Class %x not implemented\n", m_USBType, Urb->UrbControlVendorClassRequest.Value >> 8);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1399,7 +1399,7 @@ CHubController::HandleClassDevice(
|
||||||
//
|
//
|
||||||
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] HandleClassDevice invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
DPRINT1("[%s] HandleClassDevice invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
||||||
|
|
||||||
//
|
//
|
||||||
// invalid device handle
|
// invalid device handle
|
||||||
|
@ -1465,7 +1465,7 @@ CHubController::HandleGetDescriptorFromInterface(
|
||||||
//
|
//
|
||||||
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] HandleGetDescriptorFromInterface invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
DPRINT1("[%s] HandleGetDescriptorFromInterface invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
||||||
|
|
||||||
//
|
//
|
||||||
// invalid device handle
|
// invalid device handle
|
||||||
|
@ -1494,7 +1494,7 @@ CHubController::HandleGetDescriptorFromInterface(
|
||||||
Status = UsbDevice->SubmitSetupPacket(&CtrlSetup, Urb->UrbControlDescriptorRequest.TransferBufferLength, Urb->UrbControlDescriptorRequest.TransferBuffer);
|
Status = UsbDevice->SubmitSetupPacket(&CtrlSetup, Urb->UrbControlDescriptorRequest.TransferBufferLength, Urb->UrbControlDescriptorRequest.TransferBuffer);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] HandleGetDescriptorFromInterface failed with %x\n", m_USBType, Status);
|
DPRINT1("[%s] HandleGetDescriptorFromInterface failed with %x\n", m_USBType, Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1515,7 +1515,7 @@ CHubController::HandleGetDescriptor(
|
||||||
PUSBDEVICE UsbDevice;
|
PUSBDEVICE UsbDevice;
|
||||||
ULONG Length, BufferLength;
|
ULONG Length, BufferLength;
|
||||||
|
|
||||||
DPRINT("[%S] HandleGetDescriptor Type %x\n", m_USBType, Urb->UrbControlDescriptorRequest.DescriptorType);
|
DPRINT("[%s] HandleGetDescriptor Type %x\n", m_USBType, Urb->UrbControlDescriptorRequest.DescriptorType);
|
||||||
|
|
||||||
//
|
//
|
||||||
// check descriptor type
|
// check descriptor type
|
||||||
|
@ -1547,7 +1547,7 @@ CHubController::HandleGetDescriptor(
|
||||||
//
|
//
|
||||||
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] HandleGetDescriptor invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
DPRINT1("[%s] HandleGetDescriptor invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
||||||
|
|
||||||
//
|
//
|
||||||
// invalid device handle
|
// invalid device handle
|
||||||
|
@ -1654,7 +1654,7 @@ CHubController::HandleGetDescriptor(
|
||||||
//
|
//
|
||||||
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] USB_CONFIGURATION_DESCRIPTOR_TYPE invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
DPRINT1("[%s] USB_CONFIGURATION_DESCRIPTOR_TYPE invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
||||||
|
|
||||||
//
|
//
|
||||||
// invalid device handle
|
// invalid device handle
|
||||||
|
@ -1719,7 +1719,7 @@ CHubController::HandleGetDescriptor(
|
||||||
//
|
//
|
||||||
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] USB_STRING_DESCRIPTOR_TYPE invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
DPRINT1("[%s] USB_STRING_DESCRIPTOR_TYPE invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
||||||
|
|
||||||
//
|
//
|
||||||
// invalid device handle
|
// invalid device handle
|
||||||
|
@ -1749,7 +1749,7 @@ CHubController::HandleGetDescriptor(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
DPRINT1("[%S] CHubController::HandleGetDescriptor DescriptorType %x unimplemented\n", m_USBType, Urb->UrbControlDescriptorRequest.DescriptorType);
|
DPRINT1("[%s] CHubController::HandleGetDescriptor DescriptorType %x unimplemented\n", m_USBType, Urb->UrbControlDescriptorRequest.DescriptorType);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1781,7 +1781,7 @@ CHubController::HandleClassEndpoint(
|
||||||
//
|
//
|
||||||
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] HandleClassEndpoint invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
DPRINT1("[%s] HandleClassEndpoint invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
||||||
|
|
||||||
//
|
//
|
||||||
// invalid device handle
|
// invalid device handle
|
||||||
|
@ -1862,7 +1862,7 @@ CHubController::HandleVendorDevice(
|
||||||
//
|
//
|
||||||
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] HandleVendorDevice invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
DPRINT1("[%s] HandleVendorDevice invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
||||||
|
|
||||||
//
|
//
|
||||||
// invalid device handle
|
// invalid device handle
|
||||||
|
@ -1930,7 +1930,7 @@ CHubController::HandleSyncResetAndClearStall(
|
||||||
//
|
//
|
||||||
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] HandleSyncResetAndClearStall invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
DPRINT1("[%s] HandleSyncResetAndClearStall invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
||||||
|
|
||||||
//
|
//
|
||||||
// invalid device handle
|
// invalid device handle
|
||||||
|
@ -1947,7 +1947,7 @@ CHubController::HandleSyncResetAndClearStall(
|
||||||
//
|
//
|
||||||
// failed
|
// failed
|
||||||
//
|
//
|
||||||
DPRINT1("[%S] failed to reset pipe %x\n", m_USBType, Status);
|
DPRINT1("[%s] failed to reset pipe %x\n", m_USBType, Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1967,7 +1967,7 @@ CHubController::HandleSyncResetAndClearStall(
|
||||||
//
|
//
|
||||||
Status = HandleClearStall(Irp, Urb);
|
Status = HandleClearStall(Irp, Urb);
|
||||||
}
|
}
|
||||||
DPRINT1("[%S] URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL Status %x\n", m_USBType, Status);
|
DPRINT1("[%s] URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL Status %x\n", m_USBType, Status);
|
||||||
|
|
||||||
//
|
//
|
||||||
// reset data toggle
|
// reset data toggle
|
||||||
|
@ -2003,7 +2003,7 @@ CHubController::HandleAbortPipe(
|
||||||
//
|
//
|
||||||
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] HandleAbortPipe invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
DPRINT1("[%s] HandleAbortPipe invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
||||||
|
|
||||||
//
|
//
|
||||||
// invalid device handle
|
// invalid device handle
|
||||||
|
@ -2026,7 +2026,7 @@ CHubController::HandleAbortPipe(
|
||||||
// issue request
|
// issue request
|
||||||
//
|
//
|
||||||
Status = UsbDevice->AbortPipe(EndpointDescriptor);
|
Status = UsbDevice->AbortPipe(EndpointDescriptor);
|
||||||
DPRINT1("[%S] URB_FUNCTION_ABORT_PIPE Status %x\n", m_USBType, Status);
|
DPRINT1("[%s] URB_FUNCTION_ABORT_PIPE Status %x\n", m_USBType, Status);
|
||||||
|
|
||||||
//
|
//
|
||||||
// done
|
// done
|
||||||
|
@ -2059,7 +2059,7 @@ CHubController::HandleClearStall(
|
||||||
//
|
//
|
||||||
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] HandleClearStall invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
DPRINT1("[%s] HandleClearStall invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
||||||
|
|
||||||
//
|
//
|
||||||
// invalid device handle
|
// invalid device handle
|
||||||
|
@ -2076,7 +2076,7 @@ CHubController::HandleClearStall(
|
||||||
// get device
|
// get device
|
||||||
//
|
//
|
||||||
UsbDevice = PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle);
|
UsbDevice = PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle);
|
||||||
DPRINT1("[%S] URB_FUNCTION_SYNC_CLEAR_STALL\n", m_USBType);
|
DPRINT1("[%s] URB_FUNCTION_SYNC_CLEAR_STALL\n", m_USBType);
|
||||||
|
|
||||||
//
|
//
|
||||||
// initialize setup packet
|
// initialize setup packet
|
||||||
|
@ -2093,7 +2093,7 @@ CHubController::HandleClearStall(
|
||||||
//
|
//
|
||||||
Status = UsbDevice->SubmitSetupPacket(&CtrlSetup, 0, 0);
|
Status = UsbDevice->SubmitSetupPacket(&CtrlSetup, 0, 0);
|
||||||
|
|
||||||
DPRINT1("[%S] URB_FUNCTION_CLEAR_STALL Status %x\n", m_USBType, Status);
|
DPRINT1("[%s] URB_FUNCTION_CLEAR_STALL Status %x\n", m_USBType, Status);
|
||||||
|
|
||||||
//
|
//
|
||||||
// done
|
// done
|
||||||
|
@ -2124,7 +2124,7 @@ CHubController::HandleClassInterface(
|
||||||
//
|
//
|
||||||
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle)))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] HandleClassInterface invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
DPRINT1("[%s] HandleClassInterface invalid device handle %p\n", m_USBType, Urb->UrbHeader.UsbdDeviceHandle);
|
||||||
|
|
||||||
//
|
//
|
||||||
// invalid device handle
|
// invalid device handle
|
||||||
|
@ -2178,7 +2178,7 @@ CHubController::HandleClassInterface(
|
||||||
//
|
//
|
||||||
// display error
|
// display error
|
||||||
//
|
//
|
||||||
DPRINT1("[%S] URB_FUNCTION_CLASS_INTERFACE failed with Urb Status %x\n", m_USBType, Urb->UrbHeader.Status);
|
DPRINT1("[%s] URB_FUNCTION_CLASS_INTERFACE failed with Urb Status %x\n", m_USBType, Urb->UrbHeader.Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -2272,7 +2272,7 @@ CHubController::HandleDeviceControl(
|
||||||
Status = HandleVendorDevice(Irp, Urb);
|
Status = HandleVendorDevice(Irp, Urb);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DPRINT1("[%S] IOCTL_INTERNAL_USB_SUBMIT_URB Function %x NOT IMPLEMENTED\n", m_USBType, Urb->UrbHeader.Function);
|
DPRINT1("[%s] IOCTL_INTERNAL_USB_SUBMIT_URB Function %x NOT IMPLEMENTED\n", m_USBType, Urb->UrbHeader.Function);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
@ -2282,7 +2282,7 @@ CHubController::HandleDeviceControl(
|
||||||
}
|
}
|
||||||
case IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE:
|
case IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE:
|
||||||
{
|
{
|
||||||
DPRINT("[%S] IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE %p\n", m_USBType, this);
|
DPRINT("[%s] IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE %p\n", m_USBType, this);
|
||||||
|
|
||||||
if (IoStack->Parameters.Others.Argument1)
|
if (IoStack->Parameters.Others.Argument1)
|
||||||
{
|
{
|
||||||
|
@ -2307,7 +2307,7 @@ CHubController::HandleDeviceControl(
|
||||||
}
|
}
|
||||||
case IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO:
|
case IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO:
|
||||||
{
|
{
|
||||||
DPRINT("[%S] IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO\n", m_USBType);
|
DPRINT("[%s] IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO\n", m_USBType);
|
||||||
|
|
||||||
//
|
//
|
||||||
// this is the first request send, it delivers the PDO to the caller
|
// this is the first request send, it delivers the PDO to the caller
|
||||||
|
@ -2336,7 +2336,7 @@ CHubController::HandleDeviceControl(
|
||||||
}
|
}
|
||||||
case IOCTL_INTERNAL_USB_GET_HUB_COUNT:
|
case IOCTL_INTERNAL_USB_GET_HUB_COUNT:
|
||||||
{
|
{
|
||||||
DPRINT("[%S] IOCTL_INTERNAL_USB_GET_HUB_COUNT\n", m_USBType);
|
DPRINT("[%s] IOCTL_INTERNAL_USB_GET_HUB_COUNT\n", m_USBType);
|
||||||
|
|
||||||
//
|
//
|
||||||
// after IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO is delivered, the usbhub driver
|
// after IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO is delivered, the usbhub driver
|
||||||
|
@ -2359,13 +2359,13 @@ CHubController::HandleDeviceControl(
|
||||||
}
|
}
|
||||||
case IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION:
|
case IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION:
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION UNIMPLEMENTED\n", m_USBType);
|
DPRINT1("[%s] IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION UNIMPLEMENTED\n", m_USBType);
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] HandleDeviceControl>Type: IoCtl %x InputBufferLength %lu OutputBufferLength %lu NOT IMPLEMENTED\n", m_USBType,
|
DPRINT1("[%s] HandleDeviceControl>Type: IoCtl %x InputBufferLength %lu OutputBufferLength %lu NOT IMPLEMENTED\n", m_USBType,
|
||||||
IoStack->Parameters.DeviceIoControl.IoControlCode,
|
IoStack->Parameters.DeviceIoControl.IoControlCode,
|
||||||
IoStack->Parameters.DeviceIoControl.InputBufferLength,
|
IoStack->Parameters.DeviceIoControl.InputBufferLength,
|
||||||
IoStack->Parameters.DeviceIoControl.OutputBufferLength);
|
IoStack->Parameters.DeviceIoControl.OutputBufferLength);
|
||||||
|
|
|
@ -86,7 +86,7 @@ protected:
|
||||||
ULONG m_PortStatus;
|
ULONG m_PortStatus;
|
||||||
PUSBQUEUE m_Queue;
|
PUSBQUEUE m_Queue;
|
||||||
PDMAMEMORYMANAGER m_DmaManager;
|
PDMAMEMORYMANAGER m_DmaManager;
|
||||||
LPCWSTR m_USBType;
|
LPCSTR m_USBType;
|
||||||
|
|
||||||
PUSB_CONFIGURATION m_ConfigurationDescriptors;
|
PUSB_CONFIGURATION m_ConfigurationDescriptors;
|
||||||
};
|
};
|
||||||
|
@ -141,7 +141,7 @@ CUSBDevice::Initialize(
|
||||||
//
|
//
|
||||||
// failed to get usb queue
|
// failed to get usb queue
|
||||||
//
|
//
|
||||||
DPRINT1("[%S] GetUsbQueue failed with %x\n", m_USBType, Status);
|
DPRINT1("[%s] GetUsbQueue failed with %x\n", m_USBType, Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ CUSBDevice::Initialize(
|
||||||
//
|
//
|
||||||
// failed to get dma manager
|
// failed to get dma manager
|
||||||
//
|
//
|
||||||
DPRINT1("[%S] GetDMA failed with %x\n", m_USBType, Status);
|
DPRINT1("[%s] GetDMA failed with %x\n", m_USBType, Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ CUSBDevice::Initialize(
|
||||||
//
|
//
|
||||||
// failed to get device descriptor
|
// failed to get device descriptor
|
||||||
//
|
//
|
||||||
DPRINT1("[%S] Failed to get device descriptor with %x\n", m_USBType, Status);
|
DPRINT1("[%s] Failed to get device descriptor with %x\n", m_USBType, Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ CUSBDevice::GetType()
|
||||||
return Usb20Device;
|
return Usb20Device;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT1("[%S] GetType Unknown bcdUSB Type %x\n", m_USBType, m_DeviceDescriptor.bcdUSB);
|
DPRINT1("[%s] GetType Unknown bcdUSB Type %x\n", m_USBType, m_DeviceDescriptor.bcdUSB);
|
||||||
//PC_ASSERT(FALSE);
|
//PC_ASSERT(FALSE);
|
||||||
|
|
||||||
return Usb11Device;
|
return Usb11Device;
|
||||||
|
@ -311,7 +311,7 @@ CUSBDevice::SetDeviceAddress(
|
||||||
UCHAR OldAddress;
|
UCHAR OldAddress;
|
||||||
UCHAR Index;
|
UCHAR Index;
|
||||||
|
|
||||||
DPRINT1("[%S] SetDeviceAddress> Address %x\n", m_USBType, DeviceAddress);
|
DPRINT1("[%s] SetDeviceAddress> Address %x\n", m_USBType, DeviceAddress);
|
||||||
|
|
||||||
CtrlSetup = (PUSB_DEFAULT_PIPE_SETUP_PACKET)ExAllocatePoolWithTag(NonPagedPool, sizeof(USB_DEFAULT_PIPE_SETUP_PACKET), TAG_USBLIB);
|
CtrlSetup = (PUSB_DEFAULT_PIPE_SETUP_PACKET)ExAllocatePoolWithTag(NonPagedPool, sizeof(USB_DEFAULT_PIPE_SETUP_PACKET), TAG_USBLIB);
|
||||||
if (!CtrlSetup)
|
if (!CtrlSetup)
|
||||||
|
@ -334,7 +334,7 @@ CUSBDevice::SetDeviceAddress(
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
// failed to set device address
|
// failed to set device address
|
||||||
DPRINT1("[%S] SetDeviceAddress> failed to set device address with %lx Address %x\n", m_USBType, Status, DeviceAddress);
|
DPRINT1("[%s] SetDeviceAddress> failed to set device address with %lx Address %x\n", m_USBType, Status, DeviceAddress);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ CUSBDevice::SetDeviceAddress(
|
||||||
Status = CreateDeviceDescriptor();
|
Status = CreateDeviceDescriptor();
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] SetDeviceAddress failed to retrieve device descriptor with device address set Error %lx\n", m_USBType, Status);
|
DPRINT1("[%s] SetDeviceAddress failed to retrieve device descriptor with device address set Error %lx\n", m_USBType, Status);
|
||||||
// return error status
|
// return error status
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -362,7 +362,7 @@ CUSBDevice::SetDeviceAddress(
|
||||||
m_DeviceDescriptor.bNumConfigurations == 0)
|
m_DeviceDescriptor.bNumConfigurations == 0)
|
||||||
{
|
{
|
||||||
// failed to retrieve device descriptor
|
// failed to retrieve device descriptor
|
||||||
DPRINT1("[%S] SetDeviceAddress> device returned bogus device descriptor\n", m_USBType);
|
DPRINT1("[%s] SetDeviceAddress> device returned bogus device descriptor\n", m_USBType);
|
||||||
DumpDeviceDescriptor(&m_DeviceDescriptor);
|
DumpDeviceDescriptor(&m_DeviceDescriptor);
|
||||||
|
|
||||||
// return error status
|
// return error status
|
||||||
|
@ -388,7 +388,7 @@ CUSBDevice::SetDeviceAddress(
|
||||||
Status = CreateConfigurationDescriptor(Index);
|
Status = CreateConfigurationDescriptor(Index);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] SetDeviceAddress> failed to retrieve configuration %lu\n", m_USBType, Index);
|
DPRINT1("[%s] SetDeviceAddress> failed to retrieve configuration %lu\n", m_USBType, Index);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -431,7 +431,7 @@ CUSBDevice::CommitIrp(
|
||||||
//
|
//
|
||||||
// no queue, wtf?
|
// no queue, wtf?
|
||||||
//
|
//
|
||||||
DPRINT1("[%S] CommitIrp> no queue / dma !!!\n", m_USBType);
|
DPRINT1("[%s] CommitIrp> no queue / dma !!!\n", m_USBType);
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,7 +444,7 @@ CUSBDevice::CommitIrp(
|
||||||
//
|
//
|
||||||
// failed to build request
|
// failed to build request
|
||||||
//
|
//
|
||||||
DPRINT1("[%S] CommitIrp> CreateUSBRequest failed with %lx\n", m_USBType, Status);
|
DPRINT1("[%s] CommitIrp> CreateUSBRequest failed with %lx\n", m_USBType, Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -467,7 +467,7 @@ CUSBDevice::CommitIrp(
|
||||||
//
|
//
|
||||||
// failed to add request
|
// failed to add request
|
||||||
//
|
//
|
||||||
DPRINT1("[%S] failed add request to queue with %lx\n", m_USBType, Status);
|
DPRINT1("[%s] failed add request to queue with %lx\n", m_USBType, Status);
|
||||||
Request->Release();
|
Request->Release();
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -520,7 +520,7 @@ CUSBDevice::CommitSetupPacket(
|
||||||
//
|
//
|
||||||
// no queue, wtf?
|
// no queue, wtf?
|
||||||
//
|
//
|
||||||
DPRINT1("[%S] CommitSetupPacket> no queue!!!\n", m_USBType);
|
DPRINT1("[%s] CommitSetupPacket> no queue!!!\n", m_USBType);
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,7 +533,7 @@ CUSBDevice::CommitSetupPacket(
|
||||||
//
|
//
|
||||||
// failed to build request
|
// failed to build request
|
||||||
//
|
//
|
||||||
DPRINT1("[%S] CommitSetupPacket> CreateUSBRequest failed with %x\n", m_USBType, Status);
|
DPRINT1("[%s] CommitSetupPacket> CreateUSBRequest failed with %x\n", m_USBType, Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -546,7 +546,7 @@ CUSBDevice::CommitSetupPacket(
|
||||||
//
|
//
|
||||||
// failed to initialize request
|
// failed to initialize request
|
||||||
//
|
//
|
||||||
DPRINT1("[%S] CommitSetupPacket failed to initialize usb request with %x\n", m_USBType, Status);
|
DPRINT1("[%s] CommitSetupPacket failed to initialize usb request with %x\n", m_USBType, Status);
|
||||||
Request->Release();
|
Request->Release();
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -560,7 +560,7 @@ CUSBDevice::CommitSetupPacket(
|
||||||
//
|
//
|
||||||
// failed to add request
|
// failed to add request
|
||||||
//
|
//
|
||||||
DPRINT1("[%S] CommitSetupPacket> failed add request to queue with %x\n", m_USBType, Status);
|
DPRINT1("[%s] CommitSetupPacket> failed add request to queue with %x\n", m_USBType, Status);
|
||||||
Request->Release();
|
Request->Release();
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -761,7 +761,7 @@ CUSBDevice::CreateConfigurationDescriptor(
|
||||||
//
|
//
|
||||||
// failed to get partial configuration descriptor
|
// failed to get partial configuration descriptor
|
||||||
//
|
//
|
||||||
DPRINT1("[%S] Failed to get partial configuration descriptor Status %x Index %x\n", m_USBType, Status, Index);
|
DPRINT1("[%s] Failed to get partial configuration descriptor Status %x Index %x\n", m_USBType, Status, Index);
|
||||||
ExFreePoolWithTag(ConfigurationDescriptor, TAG_USBLIB);
|
ExFreePoolWithTag(ConfigurationDescriptor, TAG_USBLIB);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -775,7 +775,7 @@ CUSBDevice::CreateConfigurationDescriptor(
|
||||||
//
|
//
|
||||||
// failed to get full configuration descriptor
|
// failed to get full configuration descriptor
|
||||||
//
|
//
|
||||||
DPRINT1("[%S] Failed to get full configuration descriptor Status %x Index %x\n", m_USBType, Status, Index);
|
DPRINT1("[%s] Failed to get full configuration descriptor Status %x Index %x\n", m_USBType, Status, Index);
|
||||||
ExFreePoolWithTag(ConfigurationDescriptor, TAG_USBLIB);
|
ExFreePoolWithTag(ConfigurationDescriptor, TAG_USBLIB);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -970,7 +970,7 @@ CUSBDevice::BuildInterfaceDescriptor(
|
||||||
if (EndpointDescriptor->bLength == 0 || EndpointDescriptor->bDescriptorType == USB_INTERFACE_DESCRIPTOR_TYPE)
|
if (EndpointDescriptor->bLength == 0 || EndpointDescriptor->bDescriptorType == USB_INTERFACE_DESCRIPTOR_TYPE)
|
||||||
{
|
{
|
||||||
// bogus configuration descriptor
|
// bogus configuration descriptor
|
||||||
DPRINT1("[%S] Bogus descriptor found in InterfaceNumber %x Alternate %x EndpointIndex %x bLength %x bDescriptorType %x\n", m_USBType, InterfaceDescriptor->bInterfaceNumber, InterfaceDescriptor->bAlternateSetting, PipeIndex,
|
DPRINT1("[%s] Bogus descriptor found in InterfaceNumber %x Alternate %x EndpointIndex %x bLength %x bDescriptorType %x\n", m_USBType, InterfaceDescriptor->bInterfaceNumber, InterfaceDescriptor->bAlternateSetting, PipeIndex,
|
||||||
EndpointDescriptor->bLength, EndpointDescriptor->bDescriptorType);
|
EndpointDescriptor->bLength, EndpointDescriptor->bDescriptorType);
|
||||||
|
|
||||||
// failed
|
// failed
|
||||||
|
@ -1042,7 +1042,7 @@ CUSBDevice::SelectConfiguration(
|
||||||
|
|
||||||
if (!Found)
|
if (!Found)
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] invalid configuration value %u\n", m_USBType, ConfigurationDescriptor->bConfigurationValue);
|
DPRINT1("[%s] invalid configuration value %u\n", m_USBType, ConfigurationDescriptor->bConfigurationValue);
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1064,13 +1064,13 @@ CUSBDevice::SelectConfiguration(
|
||||||
if (!ConfigurationDescriptor)
|
if (!ConfigurationDescriptor)
|
||||||
{
|
{
|
||||||
// unconfigure request
|
// unconfigure request
|
||||||
DPRINT1("[%S] SelectConfiguration Unconfigure Request Status %lx\n", m_USBType, Status);
|
DPRINT1("[%s] SelectConfiguration Unconfigure Request Status %lx\n", m_USBType, Status);
|
||||||
m_ConfigurationIndex = 0;
|
m_ConfigurationIndex = 0;
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
// informal debug print
|
// informal debug print
|
||||||
DPRINT1("[%S] SelectConfiguration New Configuration %x Old Configuration %x Result %lx\n", m_USBType, ConfigurationIndex, m_ConfigurationIndex, Status);
|
DPRINT1("[%s] SelectConfiguration New Configuration %x Old Configuration %x Result %lx\n", m_USBType, ConfigurationIndex, m_ConfigurationIndex, Status);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
@ -1125,7 +1125,7 @@ CUSBDevice::SelectConfiguration(
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
// failed
|
// failed
|
||||||
DPRINT1("[%S] Failed to copy interface descriptor Index %lu InterfaceDescriptor %p InterfaceInfo %p\n", m_USBType, ConfigurationIndex, InterfaceDescriptor, InterfaceInfo);
|
DPRINT1("[%s] Failed to copy interface descriptor Index %lu InterfaceDescriptor %p InterfaceInfo %p\n", m_USBType, ConfigurationIndex, InterfaceDescriptor, InterfaceInfo);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1167,7 +1167,7 @@ CUSBDevice::SelectInterface(
|
||||||
if (!Found)
|
if (!Found)
|
||||||
{
|
{
|
||||||
// invalid handle passed
|
// invalid handle passed
|
||||||
DPRINT1("[%S] Invalid configuration handle passed %p\n", m_USBType, ConfigurationHandle);
|
DPRINT1("[%s] Invalid configuration handle passed %p\n", m_USBType, ConfigurationHandle);
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1182,7 +1182,7 @@ CUSBDevice::SelectInterface(
|
||||||
Status = CommitSetupPacket(&CtrlSetup, NULL, 0, NULL);
|
Status = CommitSetupPacket(&CtrlSetup, NULL, 0, NULL);
|
||||||
|
|
||||||
// informal debug print
|
// informal debug print
|
||||||
DPRINT1("[%S] SelectInterface AlternateSetting %x InterfaceNumber %x Status %lx\n", m_USBType, InterfaceInfo->AlternateSetting, InterfaceInfo->InterfaceNumber, Status);
|
DPRINT1("[%s] SelectInterface AlternateSetting %x InterfaceNumber %x Status %lx\n", m_USBType, InterfaceInfo->AlternateSetting, InterfaceInfo->InterfaceNumber, Status);
|
||||||
#if 0
|
#if 0
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -1218,7 +1218,7 @@ CUSBDevice::SelectInterface(
|
||||||
InterfaceDescriptor = USBD_ParseConfigurationDescriptor(m_ConfigurationDescriptors[ConfigurationIndex].ConfigurationDescriptor, InterfaceInfo->InterfaceNumber, InterfaceInfo->AlternateSetting);
|
InterfaceDescriptor = USBD_ParseConfigurationDescriptor(m_ConfigurationDescriptors[ConfigurationIndex].ConfigurationDescriptor, InterfaceInfo->InterfaceNumber, InterfaceInfo->AlternateSetting);
|
||||||
if (!InterfaceDescriptor)
|
if (!InterfaceDescriptor)
|
||||||
{
|
{
|
||||||
DPRINT1("[%S] No such interface Alternate %x InterfaceNumber %x\n", m_USBType, InterfaceInfo->AlternateSetting, InterfaceInfo->InterfaceNumber);
|
DPRINT1("[%s] No such interface Alternate %x InterfaceNumber %x\n", m_USBType, InterfaceInfo->AlternateSetting, InterfaceInfo->InterfaceNumber);
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1227,7 +1227,7 @@ CUSBDevice::SelectInterface(
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
// failed
|
// failed
|
||||||
DPRINT1("[%S] Failed to build interface descriptor Status %x\n", m_USBType, Status);
|
DPRINT1("[%s] Failed to build interface descriptor Status %x\n", m_USBType, Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue