altosui: Add windows installer build using 'nsis'
authorKeith Packard <keithp@keithp.com>
Sat, 4 Sep 2010 07:13:11 +0000 (00:13 -0700)
committerKeith Packard <keithp@keithp.com>
Sat, 4 Sep 2010 07:14:55 +0000 (00:14 -0700)
nsis happens to be packaged in debian, and it appears to build usable
installers, which is all very cool.

Signed-off-by: Keith Packard <keithp@keithp.com>
ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/Example.nsi [new file with mode: 0644]
ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/InstDrv-Test.exe [new file with mode: 0644]
ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/InstDrv.c [new file with mode: 0644]
ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/InstDrv.dsp [new file with mode: 0644]
ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/InstDrv.dsw [new file with mode: 0644]
ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/Readme.txt [new file with mode: 0644]
ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/ircomm2k.inf [new file with mode: 0644]
ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/ircomm2k.sys [new file with mode: 0644]
ao-tools/altosui/Instdrv/NSIS/Plugins/InstDrv.dll [new file with mode: 0644]
ao-tools/altosui/Makefile
ao-tools/altosui/altos-windows.nsi [new file with mode: 0644]

diff --git a/ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/Example.nsi b/ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/Example.nsi
new file mode 100644 (file)
index 0000000..3ed821e
--- /dev/null
@@ -0,0 +1,84 @@
+#\r
+# InstDrv Example, (c) 2003 Jan Kiszka (Jan Kiszka@web.de)\r
+#\r
+\r
+Name "InstDrv.dll test"\r
+\r
+OutFile "InstDrv-Test.exe"\r
+\r
+ShowInstDetails show\r
+\r
+ComponentText "InstDrv Plugin Usage Example"\r
+\r
+Page components\r
+Page instfiles\r
+\r
+Section "Install a Driver" InstDriver\r
+    InstDrv::InitDriverSetup /NOUNLOAD "{4d36e978-e325-11ce-bfc1-08002be10318}" "IrCOMM2k"\r
+    Pop $0\r
+    DetailPrint "InitDriverSetup: $0"\r
+\r
+    InstDrv::DeleteOemInfFiles /NOUNLOAD\r
+    Pop $0\r
+    DetailPrint "DeleteOemInfFiles: $0"\r
+    StrCmp $0 "00000000" PrintInfNames ContInst1\r
+\r
+  PrintInfNames:\r
+    Pop $0\r
+    DetailPrint "Deleted $0"\r
+    Pop $0\r
+    DetailPrint "Deleted $0"\r
+\r
+  ContInst1:\r
+    InstDrv::CreateDevice /NOUNLOAD\r
+    Pop $0\r
+    DetailPrint "CreateDevice: $0"\r
+\r
+    SetOutPath $TEMP\r
+    File "ircomm2k.inf"\r
+    File "ircomm2k.sys"\r
+\r
+    InstDrv::InstallDriver /NOUNLOAD "$TEMP\ircomm2k.inf"\r
+    Pop $0\r
+    DetailPrint "InstallDriver: $0"\r
+    StrCmp $0 "00000000" PrintReboot ContInst2\r
+\r
+  PrintReboot:\r
+    Pop $0\r
+    DetailPrint "Reboot: $0"\r
+\r
+  ContInst2:\r
+    InstDrv::CountDevices\r
+    Pop $0\r
+    DetailPrint "CountDevices: $0"\r
+SectionEnd\r
+\r
+Section "Uninstall the driver again" UninstDriver\r
+    InstDrv::InitDriverSetup /NOUNLOAD "{4d36e978-e325-11ce-bfc1-08002be10318}" "IrCOMM2k"\r
+    Pop $0\r
+    DetailPrint "InitDriverSetup: $0"\r
+\r
+    InstDrv::DeleteOemInfFiles /NOUNLOAD\r
+    Pop $0\r
+    DetailPrint "DeleteOemInfFiles: $0"\r
+    StrCmp $0 "00000000" PrintInfNames ContUninst1\r
+\r
+  PrintInfNames:\r
+    Pop $0\r
+    DetailPrint "Deleted $0"\r
+    Pop $0\r
+    DetailPrint "Deleted $0"\r
+\r
+  ContUninst1:\r
+    InstDrv::RemoveAllDevices\r
+    Pop $0\r
+    DetailPrint "RemoveAllDevices: $0"\r
+    StrCmp $0 "00000000" PrintReboot ContUninst2\r
+\r
+  PrintReboot:\r
+    Pop $0\r
+    DetailPrint "Reboot: $0"\r
+\r
+  ContUninst2:\r
+    Delete "$SYSDIR\system32\ircomm2k.sys"\r
+SectionEnd
\ No newline at end of file
diff --git a/ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/InstDrv-Test.exe b/ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/InstDrv-Test.exe
new file mode 100644 (file)
index 0000000..615bae1
Binary files /dev/null and b/ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/InstDrv-Test.exe differ
diff --git a/ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/InstDrv.c b/ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/InstDrv.c
new file mode 100644 (file)
index 0000000..efe866e
--- /dev/null
@@ -0,0 +1,704 @@
+/*\r
+\r
+InstDrv.dll - Installs or Removes Device Drivers\r
+\r
+Copyright © 2003 Jan Kiszka (Jan.Kiszka@web.de)\r
+\r
+This software is provided 'as-is', without any express or implied\r
+warranty. In no event will the authors be held liable for any damages\r
+arising from the use of this software.\r
+\r
+Permission is granted to anyone to use this software for any purpose,\r
+including commercial applications, and to alter it and redistribute\r
+it freely, subject to the following restrictions:\r
+\r
+1. The origin of this software must not be misrepresented; \r
+   you must not claim that you wrote the original software.\r
+   If you use this software in a product, an acknowledgment in the\r
+   product documentation would be appreciated but is not required.\r
+2. Altered versions must be plainly marked as such,\r
+   and must not be misrepresented as being the original software.\r
+3. This notice may not be removed or altered from any distribution.\r
+\r
+*/\r
+\r
+\r
+#include <windows.h>\r
+#include <setupapi.h>\r
+#include <newdev.h>\r
+#include "../exdll/exdll.h"\r
+\r
+\r
+char    paramBuf[1024];\r
+GUID    devClass;\r
+char    hwIdBuf[1024];\r
+int     initialized = 0;\r
+\r
+\r
+\r
+void* memset(void* dst, int val, unsigned int len)\r
+{\r
+    while (len-- > 0)\r
+        *((char *)dst)++ = val;\r
+\r
+    return NULL;\r
+}\r
+\r
+\r
+\r
+void* memcpy(void* dst, const void* src, unsigned int len)\r
+{\r
+    while (len-- > 0)\r
+        *((char *)dst)++ = *((char *)src)++;\r
+\r
+    return NULL;\r
+}\r
+\r
+\r
+\r
+int HexCharToInt(char c)\r
+{\r
+    if ((c >= '0') && (c <= '9'))\r
+        return c - '0';\r
+    else if ((c >= 'a') && (c <= 'f'))\r
+        return c - 'a' + 10;\r
+    else if ((c >= 'A') && (c <= 'F'))\r
+        return c - 'A' + 10;\r
+    else\r
+        return -1;\r
+}\r
+\r
+\r
+\r
+BOOLEAN HexStringToUInt(char* str, int width, void* valBuf)\r
+{\r
+    int i, val;\r
+\r
+\r
+    for (i = width - 4; i >= 0; i -= 4)\r
+    {\r
+        val = HexCharToInt(*str++);\r
+        if (val < 0)\r
+            return FALSE;\r
+        *(unsigned int *)valBuf += val << i;\r
+    }\r
+\r
+    return TRUE;\r
+}\r
+\r
+\r
+\r
+BOOLEAN StringToGUID(char* guidStr, GUID* pGuid)\r
+{\r
+    int i;\r
+\r
+\r
+    memset(pGuid, 0, sizeof(GUID));\r
+\r
+    if (*guidStr++ != '{')\r
+        return FALSE;\r
+\r
+    if (!HexStringToUInt(guidStr, 32, &pGuid->Data1))\r
+        return FALSE;\r
+    guidStr += 8;\r
+\r
+    if (*guidStr++ != '-')\r
+        return FALSE;\r
+\r
+    if (!HexStringToUInt(guidStr, 16, &pGuid->Data2))\r
+        return FALSE;\r
+    guidStr += 4;\r
+\r
+    if (*guidStr++ != '-')\r
+        return FALSE;\r
+\r
+    if (!HexStringToUInt(guidStr, 16, &pGuid->Data3))\r
+        return FALSE;\r
+    guidStr += 4;\r
+\r
+    if (*guidStr++ != '-')\r
+        return FALSE;\r
+\r
+    for (i = 0; i < 2; i++)\r
+    {\r
+        if (!HexStringToUInt(guidStr, 8, &pGuid->Data4[i]))\r
+            return FALSE;\r
+        guidStr += 2;\r
+    }\r
+\r
+    if (*guidStr++ != '-')\r
+        return FALSE;\r
+\r
+    for (i = 2; i < 8; i++)\r
+    {\r
+        if (!HexStringToUInt(guidStr, 8, &pGuid->Data4[i]))\r
+            return FALSE;\r
+        guidStr += 2;\r
+    }\r
+\r
+    if (*guidStr++ != '}')\r
+        return FALSE;\r
+\r
+    return TRUE;\r
+}\r
+\r
+\r
+\r
+DWORD FindNextDevice(HDEVINFO devInfoSet, SP_DEVINFO_DATA* pDevInfoData, DWORD* pIndex)\r
+{\r
+    DWORD   buffersize = 0;\r
+    LPTSTR  buffer     = NULL;\r
+    DWORD   dataType;\r
+    DWORD   result;\r
+\r
+\r
+    while (1)\r
+    {\r
+        if (!SetupDiEnumDeviceInfo(devInfoSet, (*pIndex)++, pDevInfoData))\r
+        {\r
+            result = GetLastError();\r
+            break;\r
+        }\r
+\r
+      GetDeviceRegistryProperty:\r
+        if (!SetupDiGetDeviceRegistryProperty(devInfoSet, pDevInfoData, SPDRP_HARDWAREID,\r
+                                              &dataType, (PBYTE)buffer, buffersize,\r
+                                              &buffersize))\r
+        {\r
+            result = GetLastError();\r
+\r
+            if (result == ERROR_INSUFFICIENT_BUFFER)\r
+            {\r
+                if (buffer != NULL)\r
+                    LocalFree(buffer);\r
+\r
+                buffer = (LPTSTR)LocalAlloc(LPTR, buffersize);\r
+\r
+                if (buffer == NULL)\r
+                    break;\r
+\r
+                goto GetDeviceRegistryProperty;\r
+            }\r
+            else if (result == ERROR_INVALID_DATA)\r
+                continue;   // ignore invalid entries\r
+            else\r
+                break;      // break on other errors\r
+        }\r
+\r
+        if (lstrcmpi(buffer, hwIdBuf) == 0)\r
+        {\r
+            result  = 0;\r
+            break;\r
+        }\r
+    }\r
+\r
+    if (buffer != NULL)\r
+        LocalFree(buffer);\r
+\r
+    return result;\r
+}\r
+\r
+\r
+\r
+DWORD FindFirstDevice(HWND hwndParent, const GUID* pDevClass, const LPTSTR hwId,\r
+                      HDEVINFO* pDevInfoSet, SP_DEVINFO_DATA* pDevInfoData,\r
+                      DWORD *pIndex, DWORD flags)\r
+{\r
+    DWORD   result;\r
+\r
+\r
+    *pDevInfoSet = SetupDiGetClassDevs((GUID*)pDevClass, NULL, hwndParent, flags);\r
+    if (*pDevInfoSet == INVALID_HANDLE_VALUE)\r
+        return GetLastError();\r
+\r
+    pDevInfoData->cbSize = sizeof(SP_DEVINFO_DATA);\r
+    *pIndex = 0;\r
+\r
+    result = FindNextDevice(*pDevInfoSet, pDevInfoData, pIndex);\r
+\r
+    if (result != 0)\r
+        SetupDiDestroyDeviceInfoList(*pDevInfoSet);\r
+\r
+    return result;\r
+}\r
+\r
+\r
+\r
+/*\r
+ * InstDrv::InitDriverSetup devClass drvHWID\r
+ *\r
+ *  devClass    - GUID of the driver's device setup class\r
+ *  drvHWID     - Hardware ID of the supported device\r
+ *\r
+ * Return:\r
+ *  result      - error message, empty on success\r
+ */\r
+void __declspec(dllexport) InitDriverSetup(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)\r
+{\r
+    EXDLL_INIT();\r
+\r
+    /* convert class GUID */\r
+    popstring(paramBuf);\r
+\r
+    if (!StringToGUID(paramBuf, &devClass))\r
+    {\r
+        popstring(paramBuf);\r
+        pushstring("Invalid GUID!");\r
+        return;\r
+    }\r
+\r
+    /* get hardware ID */\r
+    memset(hwIdBuf, 0, sizeof(hwIdBuf));\r
+    popstring(hwIdBuf);\r
+\r
+    initialized = 1;\r
+    pushstring("");\r
+}\r
+\r
+\r
+\r
+/*\r
+ * InstDrv::CountDevices\r
+ *\r
+ * Return:\r
+ *  result      - Number of installed devices the driver supports\r
+ */\r
+void __declspec(dllexport) CountDevices(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)\r
+{\r
+    HDEVINFO            devInfoSet;\r
+    SP_DEVINFO_DATA     devInfoData;\r
+    int                 count = 0;\r
+    char                countBuf[16];\r
+    DWORD               index;\r
+    DWORD               result;\r
+\r
+\r
+    EXDLL_INIT();\r
+\r
+    if (!initialized)\r
+    {\r
+        pushstring("Fatal error!");\r
+        return;\r
+    }\r
+\r
+    result = FindFirstDevice(hwndParent, &devClass, hwIdBuf, &devInfoSet, &devInfoData,\r
+                             &index, DIGCF_PRESENT);\r
+    if (result != 0)\r
+    {\r
+        pushstring("0");\r
+        return;\r
+    }\r
+\r
+    do\r
+    {\r
+        count++;\r
+    } while (FindNextDevice(devInfoSet, &devInfoData, &index) == 0);\r
+\r
+    SetupDiDestroyDeviceInfoList(devInfoSet);\r
+\r
+    wsprintf(countBuf, "%d", count);\r
+    pushstring(countBuf);\r
+}\r
+\r
+\r
+\r
+/*\r
+ * InstDrv::CreateDevice\r
+ *\r
+ * Return:\r
+ *  result      - Windows error code\r
+ */\r
+void __declspec(dllexport) CreateDevice(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)\r
+{\r
+    HDEVINFO            devInfoSet;\r
+    SP_DEVINFO_DATA     devInfoData;\r
+    DWORD               result = 0;\r
+    char                resultBuf[16];\r
+\r
+\r
+    EXDLL_INIT();\r
+\r
+    if (!initialized)\r
+    {\r
+        pushstring("Fatal error!");\r
+        return;\r
+    }\r
+\r
+    devInfoSet = SetupDiCreateDeviceInfoList(&devClass, hwndParent);\r
+    if (devInfoSet == INVALID_HANDLE_VALUE)\r
+    {\r
+        wsprintf(resultBuf, "%08X", GetLastError());\r
+        pushstring(resultBuf);\r
+        return;\r
+    }\r
+\r
+    devInfoData.cbSize = sizeof(SP_DEVINFO_DATA);\r
+    if (!SetupDiCreateDeviceInfo(devInfoSet, hwIdBuf, &devClass, NULL,\r
+                                 hwndParent, DICD_GENERATE_ID, &devInfoData))\r
+    {\r
+        result = GetLastError();\r
+        goto InstallCleanup;\r
+    }\r
+\r
+    if (!SetupDiSetDeviceRegistryProperty(devInfoSet, &devInfoData, SPDRP_HARDWAREID,\r
+                                          hwIdBuf, (lstrlen(hwIdBuf)+2)*sizeof(TCHAR))) \r
+    {\r
+        result = GetLastError();\r
+        goto InstallCleanup;\r
+    }\r
+\r
+    if (!SetupDiCallClassInstaller(DIF_REGISTERDEVICE, devInfoSet, &devInfoData))\r
+        result = GetLastError();\r
+\r
+  InstallCleanup:\r
+    SetupDiDestroyDeviceInfoList(devInfoSet);\r
+\r
+    wsprintf(resultBuf, "%08X", result);\r
+    pushstring(resultBuf);\r
+}\r
+\r
+\r
+\r
+/*\r
+ * InstDrv::InstallDriver infPath\r
+ *\r
+ * Return:\r
+ *  result      - Windows error code\r
+ *  reboot      - non-zero if reboot is required\r
+ */\r
+void __declspec(dllexport) InstallDriver(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)\r
+{\r
+    char    resultBuf[16];\r
+    BOOL    reboot;\r
+\r
+\r
+    EXDLL_INIT();\r
+    popstring(paramBuf);\r
+\r
+    if (!initialized)\r
+    {\r
+        pushstring("Fatal error!");\r
+        return;\r
+    }\r
+\r
+    if (!UpdateDriverForPlugAndPlayDevices(hwndParent, hwIdBuf, paramBuf,\r
+                                           INSTALLFLAG_FORCE, &reboot))\r
+    {\r
+        wsprintf(resultBuf, "%08X", GetLastError());\r
+        pushstring(resultBuf);\r
+    }\r
+    else\r
+    {\r
+        wsprintf(resultBuf, "%d", reboot);\r
+        pushstring(resultBuf);\r
+        pushstring("00000000");\r
+    }\r
+}\r
+\r
+\r
+\r
+/*\r
+ * InstDrv::DeleteOemInfFiles\r
+ *\r
+ * Return:\r
+ *  result      - Windows error code\r
+ *  oeminf      - Path of the deleted devices setup file (oemXX.inf)\r
+ *  oempnf      - Path of the deleted devices setup file (oemXX.pnf)\r
+ */\r
+void __declspec(dllexport) DeleteOemInfFiles(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)\r
+{\r
+    HDEVINFO                devInfo;\r
+    SP_DEVINFO_DATA         devInfoData;\r
+    SP_DRVINFO_DATA         drvInfoData;\r
+    SP_DRVINFO_DETAIL_DATA  drvInfoDetail;\r
+    DWORD                   index;\r
+    DWORD                   result;\r
+    char                    resultBuf[16];\r
+\r
+\r
+    if (!initialized)\r
+    {\r
+        pushstring("Fatal error!");\r
+        return;\r
+    }\r
+\r
+    result = FindFirstDevice(NULL, &devClass, hwIdBuf, &devInfo, &devInfoData, &index, 0);\r
+    if (result != 0)\r
+        goto Cleanup1;\r
+\r
+    if (!SetupDiBuildDriverInfoList(devInfo, &devInfoData, SPDIT_COMPATDRIVER))\r
+    {\r
+        result = GetLastError();\r
+        goto Cleanup2;\r
+    }\r
+\r
+    drvInfoData.cbSize = sizeof(SP_DRVINFO_DATA);\r
+    drvInfoDetail.cbSize = sizeof(SP_DRVINFO_DETAIL_DATA);\r
+\r
+    if (!SetupDiEnumDriverInfo(devInfo, &devInfoData, SPDIT_COMPATDRIVER, 0, &drvInfoData))\r
+    {\r
+        result = GetLastError();\r
+        goto Cleanup3;\r
+    }\r
+\r
+    if (!SetupDiGetDriverInfoDetail(devInfo, &devInfoData, &drvInfoData,\r
+                                    &drvInfoDetail, sizeof(drvInfoDetail), NULL))\r
+    {\r
+        result = GetLastError();\r
+\r
+        if (result != ERROR_INSUFFICIENT_BUFFER)\r
+            goto Cleanup3;\r
+\r
+        result = 0;\r
+    }\r
+\r
+    pushstring(drvInfoDetail.InfFileName);\r
+    if (!DeleteFile(drvInfoDetail.InfFileName))\r
+        result = GetLastError();\r
+    else\r
+    {\r
+        index = lstrlen(drvInfoDetail.InfFileName);\r
+        if (index > 3)\r
+        {\r
+            lstrcpy(drvInfoDetail.InfFileName+index-3, "pnf");\r
+            pushstring(drvInfoDetail.InfFileName);\r
+            if (!DeleteFile(drvInfoDetail.InfFileName))\r
+                result = GetLastError();\r
+        }\r
+    }\r
+\r
+  Cleanup3:\r
+    SetupDiDestroyDriverInfoList(devInfo, &devInfoData, SPDIT_COMPATDRIVER);\r
+\r
+  Cleanup2:\r
+    SetupDiDestroyDeviceInfoList(devInfo);\r
+\r
+  Cleanup1:\r
+    wsprintf(resultBuf, "%08X", result);\r
+    pushstring(resultBuf);\r
+}\r
+\r
+\r
+\r
+/*\r
+ * InstDrv::RemoveAllDevices\r
+ *\r
+ * Return:\r
+ *  result      - Windows error code\r
+ *  reboot      - non-zero if reboot is required\r
+ */\r
+void __declspec(dllexport) RemoveAllDevices(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)\r
+{\r
+    HDEVINFO                devInfo;\r
+    SP_DEVINFO_DATA         devInfoData;\r
+    DWORD                   index;\r
+    DWORD                   result;\r
+    char                    resultBuf[16];\r
+    BOOL                    reboot = FALSE;\r
+    SP_DEVINSTALL_PARAMS    instParams;\r
+\r
+\r
+    EXDLL_INIT();\r
+\r
+    if (!initialized)\r
+    {\r
+        pushstring("Fatal error!");\r
+        return;\r
+    }\r
+\r
+    result = FindFirstDevice(NULL, &devClass, hwIdBuf, &devInfo, &devInfoData, &index, 0);\r
+    if (result != 0)\r
+        goto Cleanup1;\r
+\r
+    do\r
+    {\r
+        if (!SetupDiCallClassInstaller(DIF_REMOVE, devInfo, &devInfoData))\r
+        {\r
+            result = GetLastError();\r
+            break;\r
+        }\r
+\r
+        instParams.cbSize = sizeof(instParams);\r
+        if (!reboot &&\r
+            SetupDiGetDeviceInstallParams(devInfo, &devInfoData, &instParams) &&\r
+            ((instParams.Flags & (DI_NEEDRESTART|DI_NEEDREBOOT)) != 0))\r
+        {\r
+            reboot = TRUE;\r
+        }\r
+\r
+        result = FindNextDevice(devInfo, &devInfoData, &index);\r
+    } while (result == 0);\r
+\r
+    SetupDiDestroyDeviceInfoList(devInfo);\r
+\r
+  Cleanup1:\r
+    if ((result == 0) || (result == ERROR_NO_MORE_ITEMS))\r
+    {\r
+        wsprintf(resultBuf, "%d", reboot);\r
+        pushstring(resultBuf);\r
+        pushstring("00000000");\r
+    }\r
+    else\r
+    {\r
+        wsprintf(resultBuf, "%08X", result);\r
+        pushstring(resultBuf);\r
+    }\r
+}\r
+\r
+\r
+\r
+/*\r
+ * InstDrv::StartSystemService serviceName\r
+ *\r
+ * Return:\r
+ *  result      - Windows error code\r
+ */\r
+void __declspec(dllexport) StartSystemService(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)\r
+{\r
+    SC_HANDLE       managerHndl;\r
+    SC_HANDLE       svcHndl;\r
+    SERVICE_STATUS  svcStatus;\r
+    DWORD           oldCheckPoint;\r
+    DWORD           result;\r
+    char            resultBuf[16];\r
+\r
+\r
+    EXDLL_INIT();\r
+    popstring(paramBuf);\r
+\r
+    managerHndl = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);\r
+    if (managerHndl == NULL)\r
+    {\r
+        result = GetLastError();\r
+        goto Cleanup1;\r
+    }\r
+\r
+    svcHndl = OpenService(managerHndl, paramBuf, SERVICE_START | SERVICE_QUERY_STATUS);\r
+    if (svcHndl == NULL)\r
+    {\r
+        result = GetLastError();\r
+        goto Cleanup2;\r
+    }\r
+\r
+    if (!StartService(svcHndl, 0, NULL) || !QueryServiceStatus(svcHndl, &svcStatus))\r
+    {\r
+        result = GetLastError();\r
+        goto Cleanup3;\r
+    }\r
+\r
+    while (svcStatus.dwCurrentState == SERVICE_START_PENDING)\r
+    {\r
+        oldCheckPoint = svcStatus.dwCheckPoint;\r
+\r
+        Sleep(svcStatus.dwWaitHint);\r
+\r
+        if (!QueryServiceStatus(svcHndl, &svcStatus))\r
+        {\r
+            result = GetLastError();\r
+            break;\r
+        }\r
+\r
+        if (oldCheckPoint >= svcStatus.dwCheckPoint)\r
+        {\r
+            if ((svcStatus.dwCurrentState == SERVICE_STOPPED) &&\r
+                (svcStatus.dwWin32ExitCode != 0))\r
+                result = svcStatus.dwWin32ExitCode;\r
+            else\r
+                result = ERROR_SERVICE_REQUEST_TIMEOUT;\r
+        }\r
+    }\r
+\r
+    if (svcStatus.dwCurrentState == SERVICE_RUNNING)\r
+        result = 0;\r
+\r
+  Cleanup3:\r
+    CloseServiceHandle(svcHndl);\r
+\r
+  Cleanup2:\r
+    CloseServiceHandle(managerHndl);\r
+\r
+  Cleanup1:\r
+    wsprintf(resultBuf, "%08X", result);\r
+    pushstring(resultBuf);\r
+}\r
+\r
+\r
+\r
+/*\r
+ * InstDrv::StopSystemService serviceName\r
+ *\r
+ * Return:\r
+ *  result      - Windows error code\r
+ */\r
+void __declspec(dllexport) StopSystemService(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)\r
+{\r
+    SC_HANDLE       managerHndl;\r
+    SC_HANDLE       svcHndl;\r
+    SERVICE_STATUS  svcStatus;\r
+    DWORD           oldCheckPoint;\r
+    DWORD           result;\r
+    char            resultBuf[16];\r
+\r
+\r
+    EXDLL_INIT();\r
+    popstring(paramBuf);\r
+\r
+    managerHndl = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);\r
+    if (managerHndl == NULL)\r
+    {\r
+        result = GetLastError();\r
+        goto Cleanup1;\r
+    }\r
+\r
+    svcHndl = OpenService(managerHndl, paramBuf, SERVICE_STOP | SERVICE_QUERY_STATUS);\r
+    if (svcHndl == NULL)\r
+    {\r
+        result = GetLastError();\r
+        goto Cleanup2;\r
+    }\r
+\r
+    if (!ControlService(svcHndl, SERVICE_CONTROL_STOP, &svcStatus))\r
+    {\r
+        result = GetLastError();\r
+        goto Cleanup3;\r
+    }\r
+\r
+    while (svcStatus.dwCurrentState == SERVICE_STOP_PENDING)\r
+    {\r
+        oldCheckPoint = svcStatus.dwCheckPoint;\r
+\r
+        Sleep(svcStatus.dwWaitHint);\r
+\r
+        if (!QueryServiceStatus(svcHndl, &svcStatus))\r
+        {\r
+            result = GetLastError();\r
+            break;\r
+        }\r
+\r
+        if (oldCheckPoint >= svcStatus.dwCheckPoint)\r
+        {\r
+            result = ERROR_SERVICE_REQUEST_TIMEOUT;\r
+            break;\r
+        }\r
+    }\r
+\r
+    if (svcStatus.dwCurrentState == SERVICE_STOPPED)\r
+        result = 0;\r
+\r
+  Cleanup3:\r
+    CloseServiceHandle(svcHndl);\r
+\r
+  Cleanup2:\r
+    CloseServiceHandle(managerHndl);\r
+\r
+  Cleanup1:\r
+    wsprintf(resultBuf, "%08X", result);\r
+    pushstring(resultBuf);\r
+}\r
+\r
+\r
+\r
+BOOL WINAPI _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)\r
+{\r
+    return TRUE;\r
+}\r
diff --git a/ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/InstDrv.dsp b/ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/InstDrv.dsp
new file mode 100644 (file)
index 0000000..874e66c
--- /dev/null
@@ -0,0 +1,110 @@
+# Microsoft Developer Studio Project File - Name="InstDrv" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** NICHT BEARBEITEN **\r
+\r
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102\r
+\r
+CFG=InstDrv - Win32 Debug\r
+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE\r
+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "InstDrv.mak".\r
+!MESSAGE \r
+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben\r
+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "InstDrv.mak" CFG="InstDrv - Win32 Debug"\r
+!MESSAGE \r
+!MESSAGE Für die Konfiguration stehen zur Auswahl:\r
+!MESSAGE \r
+!MESSAGE "InstDrv - Win32 Release" (basierend auf  "Win32 (x86) Dynamic-Link Library")\r
+!MESSAGE "InstDrv - Win32 Debug" (basierend auf  "Win32 (x86) Dynamic-Link Library")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+MTL=midl.exe\r
+RSC=rc.exe\r
+\r
+!IF  "$(CFG)" == "InstDrv - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release"\r
+# PROP BASE Intermediate_Dir "Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "Release"\r
+# PROP Intermediate_Dir "Release"\r
+# PROP Ignore_Export_Lib 1\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INSTDRV_EXPORTS" /YX /FD /c\r
+# ADD CPP /nologo /MT /W3 /GX /O1 /I "C:\Programme\WINDDK\3790\inc\ddk\w2k" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INSTDRV_EXPORTS" /FD /c\r
+# SUBTRACT CPP /YX\r
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
+# ADD BASE RSC /l 0x407 /d "NDEBUG"\r
+# ADD RSC /l 0x407 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib setupapi.lib newdev.lib /nologo /entry:"_DllMainCRTStartup" /dll /machine:I386 /nodefaultlib /out:"../../Plugins/InstDrv.dll" /libpath:"C:\Programme\WINDDK\3790\lib\w2k\i386" /opt:nowin98\r
+# SUBTRACT LINK32 /pdb:none\r
+\r
+!ELSEIF  "$(CFG)" == "InstDrv - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug"\r
+# PROP BASE Intermediate_Dir "Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "Debug"\r
+# PROP Intermediate_Dir "Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INSTDRV_EXPORTS" /YX /FD /GZ  /c\r
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INSTDRV_EXPORTS" /YX /FD /GZ  /c\r
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32\r
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32\r
+# ADD BASE RSC /l 0x407 /d "_DEBUG"\r
+# ADD RSC /l 0x407 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"_DllMainCRTStartup" /dll /debug /machine:I386 /pdbtype:sept\r
+# SUBTRACT LINK32 /nodefaultlib\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "InstDrv - Win32 Release"\r
+# Name "InstDrv - Win32 Debug"\r
+# Begin Group "Quellcodedateien"\r
+\r
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
+# Begin Source File\r
+\r
+SOURCE=.\InstDrv.c\r
+# End Source File\r
+# End Group\r
+# Begin Group "Header-Dateien"\r
+\r
+# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
+# End Group\r
+# Begin Group "Ressourcendateien"\r
+\r
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"\r
+# End Group\r
+# End Target\r
+# End Project\r
diff --git a/ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/InstDrv.dsw b/ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/InstDrv.dsw
new file mode 100644 (file)
index 0000000..b3d02f0
--- /dev/null
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00\r
+# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!\r
+\r
+###############################################################################\r
+\r
+Project: "InstDrv"=.\InstDrv.dsp - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Global:\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<3>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
diff --git a/ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/Readme.txt b/ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/Readme.txt
new file mode 100644 (file)
index 0000000..e5877aa
--- /dev/null
@@ -0,0 +1,141 @@
+InstDrv.dll version 0.2 - Installs or Removes Device Drivers\r
+------------------------------------------------------------\r
+\r
+\r
+The plugin helps you to create NSIS scripts for installing device drivers or\r
+removing them again. It can count installed device instances, create new ones\r
+or delete all supported device. InstDrv works on Windows 2000 or later.\r
+\r
+\r
+\r
+InstDrv::InitDriverSetup devClass drvHWID\r
+Return: result\r
+\r
+To start processing a driver, first call this function. devClass is the GUID\r
+of the device class the driver supports, drvHWID is the device hardware ID. If\r
+you don't know what these terms mean, you may want to take a look at the\r
+Windows DDK. This function returns an empty string on success, otherwise an\r
+error message.\r
+\r
+InitDriverSetup has to be called every time after the plugin dll has been\r
+(re-)loaded, or if you want to switch to a different driver.\r
+\r
+\r
+\r
+InstDrv::CountDevices\r
+Return: number\r
+\r
+This call returns the number of installed and supported devices of the driver.\r
+\r
+\r
+\r
+InstDrv::CreateDevice\r
+Return: result\r
+\r
+To create a new deviced node which the driver has to support, use this\r
+function. You may even call it multiple times for more than one instance. The\r
+return value is the Windows error code (in hex). Use CreateDevice before\r
+installing or updating the driver itself.\r
+\r
+\r
+\r
+InstDrv::InstallDriver infPath\r
+Return: result\r
+        reboot\r
+\r
+InstallDriver installs or updates a device driver as specified in the .inf\r
+setup script. It returns a Windows error code (in hex) and, on success, a flag\r
+signalling if a system reboot is required.\r
+\r
+\r
+\r
+InstDrv::DeleteOemInfFiles\r
+Return: result\r
+        oeminf\r
+        oempnf\r
+\r
+DeleteOemInfFiles tries to clean up the Windows inf directory by deleting the\r
+oemXX.inf and oemXX.pnf files associated with the drivers. It returns a\r
+Windows error code (in hex) and, on success, the names of the deleted files.\r
+This functions requires that at least one device instance is still present.\r
+So, call it before you remove the devices itself. You should also call it\r
+before updating a driver. This avoids that the inf directory gets slowly\r
+messed up with useless old setup scripts (which does NOT really accelerate\r
+Windows). The error code which comes up when no device is installed is\r
+"00000103".\r
+\r
+\r
+\r
+InstDrv::RemoveAllDevices\r
+Return: result\r
+        reboot\r
+\r
+This functions deletes all devices instances the driver supported. It returns\r
+a Windows error code (in hex) and, on success, a flag signalling if the system\r
+needs to be rebooted. You additionally have to remove the driver binaries from\r
+the system paths.\r
+\r
+\r
+\r
+InstDrv::StartSystemService serviceName\r
+Return: result\r
+\r
+Call this function to start the provided system service. The function blocks\r
+until the service is started or the system reported a timeout. The return value\r
+is the Windows error code (in hex).\r
+\r
+\r
+\r
+InstDrv::StopSystemService serviceName\r
+Return: result\r
+\r
+This function tries to stop the provided system service. It blocks until the\r
+service has been shut down or the system reported a timeout. The return value\r
+is the Windows error code (in hex).\r
+\r
+\r
+\r
+Example.nsi\r
+\r
+The example script installs or removes the virtual COM port driver of IrCOMM2k\r
+(2.0.0-alpha8, see www.ircomm2k.de/english). The driver and its setup script\r
+are only included for demonstration purposes, they do not work without the\r
+rest of IrCOMM2k (but they also do not cause any harm).\r
+\r
+\r
+\r
+Building the Source Code\r
+\r
+To build the plugin from the source code, some include files and libraries\r
+which come with the Windows DDK are required.\r
+\r
+\r
+\r
+History\r
+\r
+ 0.2    - fixed bug when calling InitDriverSetup the second time\r
+        - added StartSystemService and StopSystemService\r
+\r
+ 0.1    - first release\r
+\r
+\r
+\r
+License\r
+\r
+Copyright © 2003 Jan Kiszka (Jan.Kiszka@web.de)\r
+\r
+This software is provided 'as-is', without any express or implied\r
+warranty. In no event will the authors be held liable for any damages\r
+arising from the use of this software.\r
+\r
+Permission is granted to anyone to use this software for any purpose,\r
+including commercial applications, and to alter it and redistribute\r
+it freely, subject to the following restrictions:\r
+\r
+1. The origin of this software must not be misrepresented; \r
+   you must not claim that you wrote the original software.\r
+   If you use this software in a product, an acknowledgment in the\r
+   product documentation would be appreciated but is not required.\r
+2. Altered versions must be plainly marked as such,\r
+   and must not be misrepresented as being the original software.\r
+3. This notice may not be removed or altered from any distribution.\r
diff --git a/ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/ircomm2k.inf b/ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/ircomm2k.inf
new file mode 100644 (file)
index 0000000..ccda1d8
--- /dev/null
@@ -0,0 +1,137 @@
+; IrCOMM2k.inf\r
+;\r
+; Installation file for the Virtual Infrared-COM-Port\r
+;\r
+; (c) Copyright 2001, 2002 Jan Kiszka \r
+;\r
+\r
+[Version]\r
+Signature="$Windows NT$"\r
+Provider=%JK%\r
+Class=Ports\r
+ClassGUID={4d36e978-e325-11ce-bfc1-08002be10318}\r
+;DriverVer=03/26/2002,1.2.1.0\r
+\r
+[DestinationDirs]\r
+IrCOMM2k.Copy2Drivers  = 12\r
+IrCOMM2k.Copy2Winnt    = 10\r
+IrCOMM2k.Copy2System32 = 11\r
+IrCOMM2k.Copy2Help     = 18\r
+\r
+\r
+;\r
+; Driver information\r
+;\r
+\r
+[Manufacturer]\r
+%JK%   = JK.Mfg\r
+\r
+[JK.Mfg]\r
+%JK.DeviceDescIrCOMM% = IrCOMM2k_inst,IrCOMM2k\r
+\r
+\r
+;\r
+; General installation section\r
+;\r
+\r
+[IrCOMM2k_inst]\r
+CopyFiles = IrCOMM2k.Copy2Drivers ;,IrCOMM2k.Copy2System32,IrCOMM2k.Copy2Help,IrCOMM2k.Copy2Winnt\r
+;AddReg    = IrCOMM2k_inst_AddReg\r
+\r
+\r
+;\r
+; File sections\r
+;\r
+\r
+[IrCOMM2k.Copy2Drivers]\r
+ircomm2k.sys,,,2\r
+\r
+;[IrCOMM2k.Copy2System32]\r
+;ircomm2k.exe,,,2\r
+;ircomm2k.dll,,,2\r
+\r
+;[IrCOMM2k.Copy2Help]\r
+;ircomm2k.hlp,,,2\r
+\r
+;[IrCOMM2k.Copy2Winnt]\r
+;IrCOMM2k-Setup.exe,Setup.exe,,2\r
+\r
+\r
+;\r
+; Service Installation\r
+;\r
+\r
+[IrCOMM2k_inst.Services]\r
+AddService = IrCOMM2k,0x00000002,IrCOMM2k_DriverService_Inst,IrCOMM2k_DriverEventLog_Inst\r
+;AddService = IrCOMM2kSvc,,IrCOMM2k_Service_Inst\r
+\r
+[IrCOMM2k_DriverService_Inst]\r
+DisplayName    = %IrCOMM2k.DrvName%\r
+ServiceType    = 1                  ; SERVICE_KERNEL_DRIVER\r
+StartType      = 3                  ; SERVICE_DEMAND_START\r
+ErrorControl   = 0                  ; SERVICE_ERROR_IGNORE\r
+ServiceBinary  = %12%\ircomm2k.sys\r
+\r
+;[IrCOMM2k_Service_Inst]\r
+;DisplayName    = %IrCOMM2k.SvcName%\r
+;Description    = %IrCOMM2k.SvcDesc%\r
+;ServiceType    = 0x00000120         ; SERVICE_WIN32_SHARE_PROCESS, SERVICE_INTERACTIVE_PROCESS\r
+;StartType      = 2                  ; SERVICE_AUTO_START\r
+;ErrorControl   = 0                  ; SERVICE_ERROR_IGNORE\r
+;ServiceBinary  = %11%\ircomm2k.exe\r
+;Dependencies   = IrCOMM2k\r
+;AddReg         = IrCOMM2kSvcAddReg\r
+\r
+\r
+[IrCOMM2k_inst.nt.HW]\r
+AddReg=IrCOMM2kHwAddReg\r
+\r
+[IrCOMM2kHwAddReg]\r
+HKR,,PortSubClass,REG_BINARY,0x00000001\r
+;HKR,,TimeoutScaling,REG_DWORD,0x00000001\r
+;HKR,,StatusLines,REG_DWORD,0x00000000\r
+\r
+;[IrCOMM2k_inst_AddReg]\r
+;HKR,,EnumPropPages32,,"ircomm2k.dll,IrCOMM2kPropPageProvider"\r
+;HKLM,%UNINSTALL_KEY%,DisplayIcon,0x00020000,"%windir%\IrCOMM2k-Setup.exe"\r
+;HKLM,%UNINSTALL_KEY%,DisplayName,,"IrCOMM2k 1.2.1 "\r
+;HKLM,%UNINSTALL_KEY%,DisplayVersion,,"1.2.1"\r
+;HKLM,%UNINSTALL_KEY%,HelpLink,,"http://www.ircomm2k.de"\r
+;HKLM,%UNINSTALL_KEY%,Publisher,,%JK%\r
+;HKLM,%UNINSTALL_KEY%,UninstallString,0x00020000,"%windir%\IrCOMM2k-Setup.exe"\r
+\r
+;[IrCOMM2kSvcAddReg]\r
+;HKR,Parameters,ActiveConnectOnly,REG_DWORD,0x00000000\r
+\r
+\r
+[IrCOMM2k_DriverEventLog_Inst]\r
+AddReg = IrCOMM2k_DriverEventLog_AddReg\r
+\r
+[IrCOMM2k_DriverEventLog_AddReg]\r
+HKR,,EventMessageFile,REG_EXPAND_SZ,"%SystemRoot%\System32\IoLogMsg.dll;%SystemRoot%\System32\drivers\ircomm2k.sys"\r
+HKR,,TypesSupported,REG_DWORD,7\r
+\r
+\r
+[Strings]\r
+\r
+;\r
+; Non-Localizable Strings\r
+;\r
+\r
+REG_SZ         = 0x00000000\r
+REG_MULTI_SZ   = 0x00010000\r
+REG_EXPAND_SZ  = 0x00020000\r
+REG_BINARY     = 0x00000001\r
+REG_DWORD      = 0x00010001\r
+SERVICEROOT    = "System\CurrentControlSet\Services"\r
+UNINSTALL_KEY  = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\IrCOMM2k"\r
+\r
+;\r
+; Localizable Strings\r
+;\r
+\r
+JK                  = "Jan Kiszka"\r
+JK.DeviceDescIrCOMM = "Virtueller Infrarot-Kommunikationsanschluss"\r
+IrCOMM2k.DrvName    = "Virtueller Infrarot-Kommunikationsanschluss"\r
+;IrCOMM2k.SvcName    = "Virtueller Infrarot-Kommunikationsanschluß, Dienstprogramm"\r
+;IrCOMM2k.SvcDesc    = "Bildet über Infarot einen Kommunikationsanschluß nach."\r
diff --git a/ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/ircomm2k.sys b/ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/ircomm2k.sys
new file mode 100644 (file)
index 0000000..7882583
Binary files /dev/null and b/ao-tools/altosui/Instdrv/NSIS/Contrib/InstDrv/ircomm2k.sys differ
diff --git a/ao-tools/altosui/Instdrv/NSIS/Plugins/InstDrv.dll b/ao-tools/altosui/Instdrv/NSIS/Plugins/InstDrv.dll
new file mode 100644 (file)
index 0000000..482e955
Binary files /dev/null and b/ao-tools/altosui/Instdrv/NSIS/Plugins/InstDrv.dll differ
index cc9a440db1a63f05607bdbbf6fb95ffc9d2b4a17..58acb26e3bcfc1e047bdfd15b4bc15c79090c005 100644 (file)
@@ -75,12 +75,12 @@ LINUX_APP=altosui
 
 DARWIN_ZIP=Altos-Mac.zip
 
-WINDOWS_ZIP=Altos-Windows.zip
+WINDOWS_EXE=Altos-Windows.exe
 
 LINUX_TGZ=Altos-Linux.tgz
 
 all: altosui.jar $(LINUX_APP)
-fat: altosui.jar $(LINUX_APP) $(DARWIN_ZIP) $(WINDOWS_ZIP) $(LINUX_TGZ)
+fat: altosui.jar $(LINUX_APP) $(DARWIN_ZIP) $(WINDOWS_EXE) $(LINUX_TGZ)
 
 $(CLASSFILES):
 
@@ -137,7 +137,7 @@ clean:
        rm -rf windows linux
 
 distclean:     clean
-       rm -f $(DARWIN_ZIP) $(WINDOWS_ZIP) $(LINUX_TGZ)
+       rm -f $(DARWIN_ZIP) $(WINDOWS_EXE) $(LINUX_TGZ)
        rm -rf darwin fat
 
 FAT_FILES=$(FATJAR) $(FREETTSJAR) $(HEXFILES)
@@ -165,9 +165,9 @@ $(DARWIN_ZIP): $(DARWIN_FILES)
 
 WINDOWS_FILES = $(FAT_FILES) ../libaltos/altos.dll ../../telemetrum.inf
 
-$(WINDOWS_ZIP): $(WINDOWS_FILES)
+$(WINDOWS_EXE): $(WINDOWS_FILES) altos-install.nsi
        rm -f $@
        mkdir -p windows/AltOS
        rm -f windows/AltOS/*
        cp $(WINDOWS_FILES) windows/AltOS
-       cd windows && zip -j -r ../$@ AltOS
+       makensis altos-windows.nsi
diff --git a/ao-tools/altosui/altos-windows.nsi b/ao-tools/altosui/altos-windows.nsi
new file mode 100644 (file)
index 0000000..abb0823
--- /dev/null
@@ -0,0 +1,102 @@
+!addplugindir Instdrv/NSIS/Plugins
+
+Name "Altus Metrum Installer"
+
+OutFile "Altos-Windows.exe"
+
+; Default install directory
+InstallDir "$PROGRAMFILES\AltusMetrum"
+
+; Tell the installer where to re-install a new version
+InstallDirRegKey HKLM "Software\AltusMetrum" "Install_Dir"
+
+LicenseText "GNU General Public License Version 2"
+LicenseData "../../COPYING"
+
+; Need admin privs for Vista or Win7
+RequestExecutionLevel admin
+
+ShowInstDetails Show
+
+ComponentText "Altus Metrum Software and Driver Installer"
+
+; Pages to present
+
+Page license
+Page components
+Page directory
+Page instfiles
+
+UninstPage uninstConfirm
+UninstPage instfiles
+
+; And the stuff to install
+
+Section "Install Driver" InstDriver
+       InstDrv::InitDriverSetup /NOUNLOAD {4D36E96D-E325-11CE-BFC1-08002BE10318} "Altus Metrum"
+       Pop $0
+       DetailPrint "InitDriverSetup: $0"
+
+       InstDrv::DeleteOemInfFiles /NOUNLOAD
+       InstDrv::CreateDevice /NOUNLOAD
+       SetOutPath $TEMP
+       File "../../telemetrum.inf"
+       InstDrv::InstallDriver /NOUNLOAD "$TEMP\telemetrum.inf"
+SectionEnd
+
+Section "AltosUI Application"
+       SetOutPath $INSTDIR
+
+       File "windows/AltOS/*.jar"
+       File "windows/AltOS/*.dll"
+
+       CreateShortCut "$SMPROGRAMS\AltusMetrum.lnk" "$INSTDIR\altosui.jar"
+SectionEnd
+
+Section "AltosUI Desktop Shortcut"
+       CreateShortCut "$DESKTOP\AltusMetrum.lnk" "$INSTDIR\altosui.jar"
+SectionEnd
+
+Section "TeleMetrum and TeleDongle Firmware"
+
+       SetOutPath $INSTDIR
+
+       File "windows/AltOS/telemetrum-v1.0.ihx"
+       File "windows/AltOS/teledongle-v0.2.ihx"
+
+SectionEnd
+
+Section "Uninstaller"
+
+       ; Deal with the uninstaller
+       
+       SetOutPath $INSTDIR
+
+       ; Write the install path to the registry
+       WriteRegStr HKLM SOFTWARE\AltusMetrum "Install_Dir" "$INSTDIR"
+       
+       ; Write the uninstall keys for windows
+       WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "DisplayName" "Altus Metrum"
+       WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "UninstallString" '"$INSTDIR\uninstall.exe"'
+       WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoModify" "1"
+       WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoRepair" "1"
+
+       WriteUninstaller "uninstall.exe"
+SectionEnd
+
+Section "Uninstall"
+       DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum"
+       DeleteRegKey HKLM "Software\AltusMetrum"
+
+       Delete "$INSTDIR\*.*"
+       RMDir "$INSTDIR"
+
+       ; Remove devices
+       InstDrv::InitDriverSetup /NOUNLOAD {4D36E96D-E325-11CE-BFC1-08002BE10318} "Altus Metrum"
+       InstDrv::DeleteOemInfFiles /NOUNLOAD
+       InstDrv::RemoveAllDevices
+
+       ; Remove shortcuts, if any
+       Delete "$SMPROGRAMS\AltusMetrum.lnk"
+       Delete "$DESKTOP\AltusMetrum.lnk"
+SectionEnd