From 570396b76cfa896e15ab5fd143e6b425075c4ef4 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Fri, 1 May 2015 20:14:36 -1000 Subject: [PATCH] removed libwdi.. too much UAC headaches.. users will use zadig just like with dolphin --- .gitmodules | 3 -- WinUSBInstaller/WinUSBInstaller.manifest | 10 ------ WinUSBInstaller/WinUSBInstaller.pro | 20 ------------ WinUSBInstaller/main.c | 39 ----------------------- extern/libwdi | 1 - test/main.cpp | 40 ++++++++++++++++++++---- 6 files changed, 34 insertions(+), 79 deletions(-) delete mode 100644 WinUSBInstaller/WinUSBInstaller.manifest delete mode 100644 WinUSBInstaller/WinUSBInstaller.pro delete mode 100644 WinUSBInstaller/main.c delete mode 160000 extern/libwdi diff --git a/.gitmodules b/.gitmodules index 4c252a7..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "extern/libwdi"] - path = extern/libwdi - url = https://github.com/jackoalan/libwdi.git diff --git a/WinUSBInstaller/WinUSBInstaller.manifest b/WinUSBInstaller/WinUSBInstaller.manifest deleted file mode 100644 index c3b4160..0000000 --- a/WinUSBInstaller/WinUSBInstaller.manifest +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/WinUSBInstaller/WinUSBInstaller.pro b/WinUSBInstaller/WinUSBInstaller.pro deleted file mode 100644 index 3a122e2..0000000 --- a/WinUSBInstaller/WinUSBInstaller.pro +++ /dev/null @@ -1,20 +0,0 @@ -CONFIG += console -CONFIG -= app_bundle -CONFIG -= qt - -!win32 { - error(this project is designed for windows only) -} - -INCLUDEPATH += $$PWD/../extern/libwdi -LIBS += \ - Shell32.lib \ - Ole32.lib \ - Setupapi.lib \ - Advapi32.lib \ - User32.lib \ - $$PWD/../extern/libwdi/x64/Debug/lib/libwdi.lib - -SOURCES += main.c - - diff --git a/WinUSBInstaller/main.c b/WinUSBInstaller/main.c deleted file mode 100644 index 27e3364..0000000 --- a/WinUSBInstaller/main.c +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include -#include - -int main(void) -{ - printf("Hello World!\n"); - - struct wdi_device_info *device, *list; - struct wdi_options_create_list WDI_LIST_OPTS = - { - true, false, true - }; - int err = wdi_create_list(&list, &WDI_LIST_OPTS); - if (err == WDI_SUCCESS) - { - for (device = list; device != NULL; device = device->next) - { - if (device->vid == 0x57E && device->pid == 0x337 && - !strcmp(device->driver, "HidUsb")) - { - printf("GC adapter detected; installing driver\n"); - char tempDir[128]; - GetTempPathA(128, tempDir); - err = wdi_prepare_driver(device, tempDir, "winusb_smash.inf", NULL); - if (err == WDI_SUCCESS) - { - err = wdi_install_driver(device, tempDir, "winusb_smash.inf", NULL); - printf(""); - } - break; - } - } - wdi_destroy_list(list); - } - - return 0; -} - diff --git a/extern/libwdi b/extern/libwdi deleted file mode 160000 index aeacb8b..0000000 --- a/extern/libwdi +++ /dev/null @@ -1 +0,0 @@ -Subproject commit aeacb8b85c8143d0e59b0f6c4206008a017ebde0 diff --git a/test/main.cpp b/test/main.cpp index 0133f1c..faa1202 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -59,11 +59,39 @@ public: } #if _WIN32 -extern "C" int genWin32ShellExecute(const wchar_t* AppFullPath, - const wchar_t* Verb, - const wchar_t* Params, - bool ShowAppWindow, - bool WaitToFinish); +static int genWin32ShellExecute(const wchar_t* AppFullPath, + const wchar_t* Verb, + const wchar_t* Params, + bool ShowAppWindow, + bool WaitToFinish) +{ + int Result = 0; + + // Setup the required structure + SHELLEXECUTEINFO ShExecInfo; + memset(&ShExecInfo, 0, sizeof(SHELLEXECUTEINFO)); + ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO); + ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS; + ShExecInfo.hwnd = NULL; + ShExecInfo.lpVerb = Verb; + ShExecInfo.lpFile = AppFullPath; + ShExecInfo.lpParameters = Params; + ShExecInfo.lpDirectory = NULL; + ShExecInfo.nShow = (ShowAppWindow ? SW_SHOW : SW_HIDE); + ShExecInfo.hInstApp = NULL; + + // Spawn the process + if (ShellExecuteEx(&ShExecInfo) == FALSE) + { + Result = -1; // Failed to execute process + } else if (WaitToFinish) + { + WaitForSingleObject(ShExecInfo.hProcess, INFINITE); + } + + return Result; +} + #include static void scanWinUSB() { @@ -81,7 +109,7 @@ static void scanWinUSB() !strcmp(device->driver, "HidUsb")) { printf("GC adapter detected; installing driver\n"); - + genWin32ShellExecute(L"WinUsbInstaller.exe", L"", L"", false, true); } } wdi_destroy_list(list);