Author: janderwald
Date: Sat Feb 21 10:09:36 2015
New Revision: 66379
URL:
http://svn.reactos.org/svn/reactos?rev=66379&view=rev
Log:
[STREAMCI]
- start implement streaming device class installer
Added:
trunk/reactos/dll/win32/streamci/ (with props)
trunk/reactos/dll/win32/streamci/CMakeLists.txt (with props)
trunk/reactos/dll/win32/streamci/precomp.h (with props)
trunk/reactos/dll/win32/streamci/streamci.c (with props)
trunk/reactos/dll/win32/streamci/streamci.rc (with props)
trunk/reactos/dll/win32/streamci/streamci.spec (with props)
Modified:
trunk/reactos/dll/win32/CMakeLists.txt
Modified: trunk/reactos/dll/win32/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/CMakeLists.txt?r…
==============================================================================
--- trunk/reactos/dll/win32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/CMakeLists.txt [iso-8859-1] Sat Feb 21 10:09:36 2015
@@ -196,6 +196,7 @@
add_subdirectory(stdole2.tlb)
add_subdirectory(stdole32.tlb)
add_subdirectory(sti)
+add_subdirectory(streamci)
add_subdirectory(sxs)
add_subdirectory(syssetup)
add_subdirectory(t2embed)
Propchange: trunk/reactos/dll/win32/streamci/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Sat Feb 21 10:09:36 2015
@@ -0,0 +1 @@
+((CORE|ROSTESTS|ROSAPPS)-\d+)(,? ?((CORE|ROSTESTS|ROSAPPS)-\d+))*(,? ?(and |or
)?((CORE|ROSTESTS|ROSAPPS)-\d+))?
Propchange: trunk/reactos/dll/win32/streamci/
------------------------------------------------------------------------------
bugtraq:message = See issue %BUGID% for more details.
Propchange: trunk/reactos/dll/win32/streamci/
------------------------------------------------------------------------------
bugtraq:url =
https://jira.reactos.org/browse/%BUGID%
Propchange: trunk/reactos/dll/win32/streamci/
------------------------------------------------------------------------------
tsvn:logminsize = 10
Added: trunk/reactos/dll/win32/streamci/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/streamci/CMakeLi…
==============================================================================
--- trunk/reactos/dll/win32/streamci/CMakeLists.txt (added)
+++ trunk/reactos/dll/win32/streamci/CMakeLists.txt [iso-8859-1] Sat Feb 21 10:09:36 2015
@@ -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)
Propchange: trunk/reactos/dll/win32/streamci/CMakeLists.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/win32/streamci/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/streamci/precomp…
==============================================================================
--- trunk/reactos/dll/win32/streamci/precomp.h (added)
+++ trunk/reactos/dll/win32/streamci/precomp.h [iso-8859-1] Sat Feb 21 10:09:36 2015
@@ -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 */
+
Propchange: trunk/reactos/dll/win32/streamci/precomp.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/win32/streamci/streamci.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/streamci/streamc…
==============================================================================
--- trunk/reactos/dll/win32/streamci/streamci.c (added)
+++ trunk/reactos/dll/win32/streamci/streamci.c [iso-8859-1] Sat Feb 21 10:09:36 2015
@@ -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
+
+}
Propchange: trunk/reactos/dll/win32/streamci/streamci.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/win32/streamci/streamci.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/streamci/streamc…
==============================================================================
--- trunk/reactos/dll/win32/streamci/streamci.rc (added)
+++ trunk/reactos/dll/win32/streamci/streamci.rc [iso-8859-1] Sat Feb 21 10:09:36 2015
@@ -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)
+
Propchange: trunk/reactos/dll/win32/streamci/streamci.rc
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/win32/streamci/streamci.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/streamci/streamc…
==============================================================================
--- trunk/reactos/dll/win32/streamci/streamci.spec (added)
+++ trunk/reactos/dll/win32/streamci/streamci.spec [iso-8859-1] Sat Feb 21 10:09:36 2015
@@ -0,0 +1 @@
+7 stdcall StreamingDeviceSetupW(ptr ptr ptr long)
Propchange: trunk/reactos/dll/win32/streamci/streamci.spec
------------------------------------------------------------------------------
svn:eol-style = native