mirror of
https://github.com/reactos/reactos.git
synced 2025-05-07 18:56:48 +00:00
[STREAMCI]
- start implement streaming device class installer svn path=/trunk/; revision=66379
This commit is contained in:
parent
695876f5d8
commit
ac5ea38615
6 changed files with 255 additions and 0 deletions
|
@ -196,6 +196,7 @@ add_subdirectory(srclient)
|
||||||
add_subdirectory(stdole2.tlb)
|
add_subdirectory(stdole2.tlb)
|
||||||
add_subdirectory(stdole32.tlb)
|
add_subdirectory(stdole32.tlb)
|
||||||
add_subdirectory(sti)
|
add_subdirectory(sti)
|
||||||
|
add_subdirectory(streamci)
|
||||||
add_subdirectory(sxs)
|
add_subdirectory(sxs)
|
||||||
add_subdirectory(syssetup)
|
add_subdirectory(syssetup)
|
||||||
add_subdirectory(t2embed)
|
add_subdirectory(t2embed)
|
||||||
|
|
20
reactos/dll/win32/streamci/CMakeLists.txt
Normal file
20
reactos/dll/win32/streamci/CMakeLists.txt
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
remove_definitions(-D_WIN32_WINNT=0x502)
|
||||||
|
add_definitions(-D_WIN32_WINNT=0x600)
|
||||||
|
|
||||||
|
spec2def(streamci.dll streamci.spec)
|
||||||
|
|
||||||
|
list(APPEND SOURCE
|
||||||
|
streamci.c
|
||||||
|
precomp.h)
|
||||||
|
|
||||||
|
add_library(streamci SHARED
|
||||||
|
${SOURCE}
|
||||||
|
streamci.rc
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/streamci.def)
|
||||||
|
|
||||||
|
set_module_type(streamci win32dll)
|
||||||
|
target_link_libraries(streamci uuid wine)
|
||||||
|
add_importlibs(streamci rpcrt4 setupapi advapi32 iphlpapi dhcpcsvc ole32 user32 comctl32 ws2_32 msvcrt kernel32 ntdll)
|
||||||
|
add_pch(streamci precomp.h SOURCE)
|
||||||
|
add_cd_file(TARGET streamci DESTINATION reactos/system32 FOR all)
|
28
reactos/dll/win32/streamci/precomp.h
Normal file
28
reactos/dll/win32/streamci/precomp.h
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#ifndef PRECOMP_H__
|
||||||
|
#define PRECOMP_H__
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define WIN32_NO_STATUS
|
||||||
|
#define _INC_WINDOWS
|
||||||
|
#define COM_NO_WINDOWS_H
|
||||||
|
|
||||||
|
#define COBJMACROS
|
||||||
|
#define NONAMELESSUNION
|
||||||
|
#define NONAMELESSSTRUCT
|
||||||
|
|
||||||
|
#include <windef.h>
|
||||||
|
#include <winbase.h>
|
||||||
|
#include <winreg.h>
|
||||||
|
#include <objbase.h>
|
||||||
|
#include <netcfgx.h>
|
||||||
|
#include <setupapi.h>
|
||||||
|
#include <netcfgn.h>
|
||||||
|
#include <devguid.h>
|
||||||
|
#include <strsafe.h>
|
||||||
|
#include <winioctl.h>
|
||||||
|
#include <swenum.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#endif /* EOF */
|
||||||
|
|
187
reactos/dll/win32/streamci/streamci.c
Normal file
187
reactos/dll/win32/streamci/streamci.c
Normal file
|
@ -0,0 +1,187 @@
|
||||||
|
#include "precomp.h"
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
PerformIO(IN HANDLE hDevice,
|
||||||
|
IN DWORD dwCtlCode,
|
||||||
|
IN LPVOID lpBufferIn,
|
||||||
|
IN DWORD dwBufferSizeIn,
|
||||||
|
OUT LPVOID lpBufferOut,
|
||||||
|
OUT DWORD dwBufferSizeOut,
|
||||||
|
OUT LPDWORD lpNumberBytes)
|
||||||
|
{
|
||||||
|
OVERLAPPED overlapped;
|
||||||
|
DWORD dwResult;
|
||||||
|
|
||||||
|
ZeroMemory(&overlapped, sizeof(OVERLAPPED));
|
||||||
|
overlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||||
|
if (!overlapped.hEvent)
|
||||||
|
{
|
||||||
|
// failed to init event
|
||||||
|
return GetLastError();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DeviceIoControl(hDevice, dwCtlCode, lpBufferIn, dwBufferSizeIn, lpBufferOut, dwBufferSizeOut, lpNumberBytes, &overlapped))
|
||||||
|
{
|
||||||
|
dwResult = ERROR_SUCCESS;
|
||||||
|
}
|
||||||
|
else if (GetLastError() == ERROR_IO_PENDING)
|
||||||
|
{
|
||||||
|
if (GetOverlappedResult(hDevice, &overlapped, lpNumberBytes, TRUE))
|
||||||
|
{
|
||||||
|
dwResult = ERROR_SUCCESS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dwResult = GetLastError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dwResult = GetLastError();
|
||||||
|
}
|
||||||
|
CloseHandle(overlapped.hEvent);
|
||||||
|
return dwResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
InstallSoftwareDeviceInterface(IN LPGUID DeviceId,
|
||||||
|
IN LPGUID InterfaceId,
|
||||||
|
IN LPWSTR ReferenceString)
|
||||||
|
{
|
||||||
|
HDEVINFO hDevInfo;
|
||||||
|
SP_DEVICE_INTERFACE_DATA DeviceInterfaceData;
|
||||||
|
GUID SWBusGuid = {STATIC_BUSID_SoftwareDeviceEnumerator};
|
||||||
|
PSP_DEVICE_INTERFACE_DETAIL_DATA_W DeviceInterfaceDetailData;
|
||||||
|
HANDLE hDevice;
|
||||||
|
PSWENUM_INSTALL_INTERFACE InstallInterface;
|
||||||
|
DWORD dwResult;
|
||||||
|
|
||||||
|
hDevInfo = SetupDiGetClassDevsW(&GUID_DEVCLASS_SYSTEM, NULL, NULL, DIGCF_DEVICEINTERFACE| DIGCF_PRESENT);
|
||||||
|
if (!hDevInfo)
|
||||||
|
{
|
||||||
|
// failed
|
||||||
|
return GetLastError();
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceInterfaceData.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
|
||||||
|
if (!SetupDiEnumDeviceInterfaces(hDevInfo, NULL, &SWBusGuid, 0, &DeviceInterfaceData))
|
||||||
|
{
|
||||||
|
// failed
|
||||||
|
SetupDiDestroyDeviceInfoList(hDevInfo);
|
||||||
|
return GetLastError();
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceInterfaceDetailData = (PSP_DEVICE_INTERFACE_DETAIL_DATA_W)HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR) + sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W));
|
||||||
|
if (!DeviceInterfaceDetailData)
|
||||||
|
{
|
||||||
|
// failed
|
||||||
|
SetupDiDestroyDeviceInfoList(hDevInfo);
|
||||||
|
return GetLastError();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SetupDiGetDeviceInterfaceDetailW(hDevInfo, &DeviceInterfaceData, DeviceInterfaceDetailData,MAX_PATH * sizeof(WCHAR) + sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W), NULL, NULL))
|
||||||
|
{
|
||||||
|
// failed
|
||||||
|
HeapFree(GetProcessHeap(), 0, DeviceInterfaceDetailData);
|
||||||
|
SetupDiDestroyDeviceInfoList(hDevInfo);
|
||||||
|
return GetLastError();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
hDevice = CreateFileW(DeviceInterfaceDetailData->DevicePath, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED|FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
|
if (hDevice == INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
// failed
|
||||||
|
HeapFree(GetProcessHeap(), 0, DeviceInterfaceDetailData);
|
||||||
|
SetupDiDestroyDeviceInfoList(hDevInfo);
|
||||||
|
return GetLastError();
|
||||||
|
}
|
||||||
|
|
||||||
|
InstallInterface = (PSWENUM_INSTALL_INTERFACE)HeapAlloc(GetProcessHeap(), 0, sizeof(SWENUM_INSTALL_INTERFACE) + wcslen(ReferenceString) * sizeof(WCHAR));
|
||||||
|
if (!InstallInterface)
|
||||||
|
{
|
||||||
|
// failed
|
||||||
|
CloseHandle(hDevice);
|
||||||
|
HeapFree(GetProcessHeap(), 0, DeviceInterfaceDetailData);
|
||||||
|
SetupDiDestroyDeviceInfoList(hDevInfo);
|
||||||
|
return GetLastError();
|
||||||
|
}
|
||||||
|
|
||||||
|
// init install interface param
|
||||||
|
InstallInterface->DeviceId = *DeviceId;
|
||||||
|
InstallInterface->InterfaceId = *InterfaceId;
|
||||||
|
wcscpy(InstallInterface->ReferenceString, ReferenceString);
|
||||||
|
|
||||||
|
PerformIO(hDevice, IOCTL_SWENUM_INSTALL_INTERFACE, InstallInterface, sizeof(SWENUM_INSTALL_INTERFACE) + wcslen(ReferenceString) * sizeof(WCHAR), NULL, 0, NULL);
|
||||||
|
dwResult = HeapFree(GetProcessHeap(), 0, InstallInterface);
|
||||||
|
|
||||||
|
CloseHandle(hDevice);
|
||||||
|
HeapFree(GetProcessHeap(), 0, DeviceInterfaceDetailData);
|
||||||
|
SetupDiDestroyDeviceInfoList(hDevInfo);
|
||||||
|
return dwResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
WINAPI
|
||||||
|
StreamingDeviceSetupW(IN HWND hwnd,
|
||||||
|
IN HINSTANCE hinst,
|
||||||
|
IN LPWSTR lpszCmdLine,
|
||||||
|
IN int nCmdShow)
|
||||||
|
{
|
||||||
|
DWORD Length;
|
||||||
|
LPWSTR pCmdLine;
|
||||||
|
LPWSTR pStr;
|
||||||
|
GUID Guids[2];
|
||||||
|
//WCHAR DevicePath[MAX_PATH];
|
||||||
|
HRESULT hResult;
|
||||||
|
DWORD Index;
|
||||||
|
|
||||||
|
Length = (wcslen(lpszCmdLine) + 1) * sizeof(WCHAR);
|
||||||
|
|
||||||
|
pCmdLine = (LPWSTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, Length);
|
||||||
|
if (pCmdLine == NULL)
|
||||||
|
{
|
||||||
|
// no memory
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hResult = StringCbCopyExW(pCmdLine, Length, lpszCmdLine, NULL, NULL, STRSAFE_NULL_ON_FAILURE);
|
||||||
|
if (hResult != S_OK)
|
||||||
|
{
|
||||||
|
// failed
|
||||||
|
HeapFree(GetProcessHeap(), 0, pCmdLine);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pStr = wcstok(pCmdLine, L",\t\"");
|
||||||
|
Index = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (pStr == NULL)
|
||||||
|
{
|
||||||
|
// invalid parameter
|
||||||
|
HeapFree(GetProcessHeap(), 0, pCmdLine);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hResult = IIDFromString(pStr, &Guids[Index]);
|
||||||
|
if (hResult != S_OK)
|
||||||
|
{
|
||||||
|
// invalid parameter
|
||||||
|
HeapFree(GetProcessHeap(), 0, pCmdLine);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Index++;
|
||||||
|
pStr = wcstok(NULL, L",\t\"");
|
||||||
|
|
||||||
|
|
||||||
|
}while(Index < 2);
|
||||||
|
|
||||||
|
|
||||||
|
hResult = InstallSoftwareDeviceInterface(&Guids[0], &Guids[1], pStr);
|
||||||
|
|
||||||
|
// FIXME
|
||||||
|
// install inf section
|
||||||
|
|
||||||
|
}
|
18
reactos/dll/win32/streamci/streamci.rc
Normal file
18
reactos/dll/win32/streamci/streamci.rc
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#define WIN32_NO_STATUS
|
||||||
|
#include <windef.h>
|
||||||
|
#include <winuser.h>
|
||||||
|
#include <commctrl.h>
|
||||||
|
|
||||||
|
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||||
|
|
||||||
|
#define REACTOS_VERSION_DLL
|
||||||
|
#define REACTOS_STR_FILE_DESCRIPTION "Streaming Device Class Installer"
|
||||||
|
#define REACTOS_STR_INTERNAL_NAME "streamci.dll"
|
||||||
|
#define REACTOS_STR_ORIGINAL_FILENAME "streamci.dll"
|
||||||
|
#define REACTOS_STR_PRODUCT_VERSION "5.1.2600.3264"
|
||||||
|
#define REACTOS_STR_FILE_VERSION "5.1.2600.3264"
|
||||||
|
#include <reactos/version.rc>
|
||||||
|
|
||||||
|
/* UTF-8 */
|
||||||
|
#pragma code_page(65001)
|
||||||
|
|
1
reactos/dll/win32/streamci/streamci.spec
Normal file
1
reactos/dll/win32/streamci/streamci.spec
Normal file
|
@ -0,0 +1 @@
|
||||||
|
7 stdcall StreamingDeviceSetupW(ptr ptr ptr long)
|
Loading…
Reference in a new issue