Initial Commit - Copy from Altus Metrum AltOS
This commit is contained in:
84
altosui/Instdrv/NSIS/Contrib/InstDrv/Example.nsi
Normal file
84
altosui/Instdrv/NSIS/Contrib/InstDrv/Example.nsi
Normal file
@@ -0,0 +1,84 @@
|
||||
#
|
||||
# InstDrv Example, (c) 2003 Jan Kiszka (Jan Kiszka@web.de)
|
||||
#
|
||||
|
||||
Name "InstDrv.dll test"
|
||||
|
||||
OutFile "InstDrv-Test.exe"
|
||||
|
||||
ShowInstDetails show
|
||||
|
||||
ComponentText "InstDrv Plugin Usage Example"
|
||||
|
||||
Page components
|
||||
Page instfiles
|
||||
|
||||
Section "Install a Driver" InstDriver
|
||||
InstDrv::InitDriverSetup /NOUNLOAD "{4d36e978-e325-11ce-bfc1-08002be10318}" "IrCOMM2k"
|
||||
Pop $0
|
||||
DetailPrint "InitDriverSetup: $0"
|
||||
|
||||
InstDrv::DeleteOemInfFiles /NOUNLOAD
|
||||
Pop $0
|
||||
DetailPrint "DeleteOemInfFiles: $0"
|
||||
StrCmp $0 "00000000" PrintInfNames ContInst1
|
||||
|
||||
PrintInfNames:
|
||||
Pop $0
|
||||
DetailPrint "Deleted $0"
|
||||
Pop $0
|
||||
DetailPrint "Deleted $0"
|
||||
|
||||
ContInst1:
|
||||
InstDrv::CreateDevice /NOUNLOAD
|
||||
Pop $0
|
||||
DetailPrint "CreateDevice: $0"
|
||||
|
||||
SetOutPath $TEMP
|
||||
File "ircomm2k.inf"
|
||||
File "ircomm2k.sys"
|
||||
|
||||
InstDrv::InstallDriver /NOUNLOAD "$TEMP\ircomm2k.inf"
|
||||
Pop $0
|
||||
DetailPrint "InstallDriver: $0"
|
||||
StrCmp $0 "00000000" PrintReboot ContInst2
|
||||
|
||||
PrintReboot:
|
||||
Pop $0
|
||||
DetailPrint "Reboot: $0"
|
||||
|
||||
ContInst2:
|
||||
InstDrv::CountDevices
|
||||
Pop $0
|
||||
DetailPrint "CountDevices: $0"
|
||||
SectionEnd
|
||||
|
||||
Section "Uninstall the driver again" UninstDriver
|
||||
InstDrv::InitDriverSetup /NOUNLOAD "{4d36e978-e325-11ce-bfc1-08002be10318}" "IrCOMM2k"
|
||||
Pop $0
|
||||
DetailPrint "InitDriverSetup: $0"
|
||||
|
||||
InstDrv::DeleteOemInfFiles /NOUNLOAD
|
||||
Pop $0
|
||||
DetailPrint "DeleteOemInfFiles: $0"
|
||||
StrCmp $0 "00000000" PrintInfNames ContUninst1
|
||||
|
||||
PrintInfNames:
|
||||
Pop $0
|
||||
DetailPrint "Deleted $0"
|
||||
Pop $0
|
||||
DetailPrint "Deleted $0"
|
||||
|
||||
ContUninst1:
|
||||
InstDrv::RemoveAllDevices
|
||||
Pop $0
|
||||
DetailPrint "RemoveAllDevices: $0"
|
||||
StrCmp $0 "00000000" PrintReboot ContUninst2
|
||||
|
||||
PrintReboot:
|
||||
Pop $0
|
||||
DetailPrint "Reboot: $0"
|
||||
|
||||
ContUninst2:
|
||||
Delete "$SYSDIR\system32\ircomm2k.sys"
|
||||
SectionEnd
|
BIN
altosui/Instdrv/NSIS/Contrib/InstDrv/InstDrv-Test.exe
Normal file
BIN
altosui/Instdrv/NSIS/Contrib/InstDrv/InstDrv-Test.exe
Normal file
Binary file not shown.
704
altosui/Instdrv/NSIS/Contrib/InstDrv/InstDrv.c
Normal file
704
altosui/Instdrv/NSIS/Contrib/InstDrv/InstDrv.c
Normal file
@@ -0,0 +1,704 @@
|
||||
/*
|
||||
|
||||
InstDrv.dll - Installs or Removes Device Drivers
|
||||
|
||||
Copyright <20> 2003 Jan Kiszka (Jan.Kiszka@web.de)
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute
|
||||
it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented;
|
||||
you must not claim that you wrote the original software.
|
||||
If you use this software in a product, an acknowledgment in the
|
||||
product documentation would be appreciated but is not required.
|
||||
2. Altered versions must be plainly marked as such,
|
||||
and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any distribution.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
#include <setupapi.h>
|
||||
#include <newdev.h>
|
||||
#include "../exdll/exdll.h"
|
||||
|
||||
|
||||
char paramBuf[1024];
|
||||
GUID devClass;
|
||||
char hwIdBuf[1024];
|
||||
int initialized = 0;
|
||||
|
||||
|
||||
|
||||
void* memset(void* dst, int val, unsigned int len)
|
||||
{
|
||||
while (len-- > 0)
|
||||
*((char *)dst)++ = val;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void* memcpy(void* dst, const void* src, unsigned int len)
|
||||
{
|
||||
while (len-- > 0)
|
||||
*((char *)dst)++ = *((char *)src)++;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int HexCharToInt(char c)
|
||||
{
|
||||
if ((c >= '0') && (c <= '9'))
|
||||
return c - '0';
|
||||
else if ((c >= 'a') && (c <= 'f'))
|
||||
return c - 'a' + 10;
|
||||
else if ((c >= 'A') && (c <= 'F'))
|
||||
return c - 'A' + 10;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN HexStringToUInt(char* str, int width, void* valBuf)
|
||||
{
|
||||
int i, val;
|
||||
|
||||
|
||||
for (i = width - 4; i >= 0; i -= 4)
|
||||
{
|
||||
val = HexCharToInt(*str++);
|
||||
if (val < 0)
|
||||
return FALSE;
|
||||
*(unsigned int *)valBuf += val << i;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN StringToGUID(char* guidStr, GUID* pGuid)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
memset(pGuid, 0, sizeof(GUID));
|
||||
|
||||
if (*guidStr++ != '{')
|
||||
return FALSE;
|
||||
|
||||
if (!HexStringToUInt(guidStr, 32, &pGuid->Data1))
|
||||
return FALSE;
|
||||
guidStr += 8;
|
||||
|
||||
if (*guidStr++ != '-')
|
||||
return FALSE;
|
||||
|
||||
if (!HexStringToUInt(guidStr, 16, &pGuid->Data2))
|
||||
return FALSE;
|
||||
guidStr += 4;
|
||||
|
||||
if (*guidStr++ != '-')
|
||||
return FALSE;
|
||||
|
||||
if (!HexStringToUInt(guidStr, 16, &pGuid->Data3))
|
||||
return FALSE;
|
||||
guidStr += 4;
|
||||
|
||||
if (*guidStr++ != '-')
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
if (!HexStringToUInt(guidStr, 8, &pGuid->Data4[i]))
|
||||
return FALSE;
|
||||
guidStr += 2;
|
||||
}
|
||||
|
||||
if (*guidStr++ != '-')
|
||||
return FALSE;
|
||||
|
||||
for (i = 2; i < 8; i++)
|
||||
{
|
||||
if (!HexStringToUInt(guidStr, 8, &pGuid->Data4[i]))
|
||||
return FALSE;
|
||||
guidStr += 2;
|
||||
}
|
||||
|
||||
if (*guidStr++ != '}')
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
DWORD FindNextDevice(HDEVINFO devInfoSet, SP_DEVINFO_DATA* pDevInfoData, DWORD* pIndex)
|
||||
{
|
||||
DWORD buffersize = 0;
|
||||
LPTSTR buffer = NULL;
|
||||
DWORD dataType;
|
||||
DWORD result;
|
||||
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (!SetupDiEnumDeviceInfo(devInfoSet, (*pIndex)++, pDevInfoData))
|
||||
{
|
||||
result = GetLastError();
|
||||
break;
|
||||
}
|
||||
|
||||
GetDeviceRegistryProperty:
|
||||
if (!SetupDiGetDeviceRegistryProperty(devInfoSet, pDevInfoData, SPDRP_HARDWAREID,
|
||||
&dataType, (PBYTE)buffer, buffersize,
|
||||
&buffersize))
|
||||
{
|
||||
result = GetLastError();
|
||||
|
||||
if (result == ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
if (buffer != NULL)
|
||||
LocalFree(buffer);
|
||||
|
||||
buffer = (LPTSTR)LocalAlloc(LPTR, buffersize);
|
||||
|
||||
if (buffer == NULL)
|
||||
break;
|
||||
|
||||
goto GetDeviceRegistryProperty;
|
||||
}
|
||||
else if (result == ERROR_INVALID_DATA)
|
||||
continue; // ignore invalid entries
|
||||
else
|
||||
break; // break on other errors
|
||||
}
|
||||
|
||||
if (lstrcmpi(buffer, hwIdBuf) == 0)
|
||||
{
|
||||
result = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (buffer != NULL)
|
||||
LocalFree(buffer);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
DWORD FindFirstDevice(HWND hwndParent, const GUID* pDevClass, const LPTSTR hwId,
|
||||
HDEVINFO* pDevInfoSet, SP_DEVINFO_DATA* pDevInfoData,
|
||||
DWORD *pIndex, DWORD flags)
|
||||
{
|
||||
DWORD result;
|
||||
|
||||
|
||||
*pDevInfoSet = SetupDiGetClassDevs((GUID*)pDevClass, NULL, hwndParent, flags);
|
||||
if (*pDevInfoSet == INVALID_HANDLE_VALUE)
|
||||
return GetLastError();
|
||||
|
||||
pDevInfoData->cbSize = sizeof(SP_DEVINFO_DATA);
|
||||
*pIndex = 0;
|
||||
|
||||
result = FindNextDevice(*pDevInfoSet, pDevInfoData, pIndex);
|
||||
|
||||
if (result != 0)
|
||||
SetupDiDestroyDeviceInfoList(*pDevInfoSet);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* InstDrv::InitDriverSetup devClass drvHWID
|
||||
*
|
||||
* devClass - GUID of the driver's device setup class
|
||||
* drvHWID - Hardware ID of the supported device
|
||||
*
|
||||
* Return:
|
||||
* result - error message, empty on success
|
||||
*/
|
||||
void __declspec(dllexport) InitDriverSetup(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)
|
||||
{
|
||||
EXDLL_INIT();
|
||||
|
||||
/* convert class GUID */
|
||||
popstring(paramBuf);
|
||||
|
||||
if (!StringToGUID(paramBuf, &devClass))
|
||||
{
|
||||
popstring(paramBuf);
|
||||
pushstring("Invalid GUID!");
|
||||
return;
|
||||
}
|
||||
|
||||
/* get hardware ID */
|
||||
memset(hwIdBuf, 0, sizeof(hwIdBuf));
|
||||
popstring(hwIdBuf);
|
||||
|
||||
initialized = 1;
|
||||
pushstring("");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* InstDrv::CountDevices
|
||||
*
|
||||
* Return:
|
||||
* result - Number of installed devices the driver supports
|
||||
*/
|
||||
void __declspec(dllexport) CountDevices(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)
|
||||
{
|
||||
HDEVINFO devInfoSet;
|
||||
SP_DEVINFO_DATA devInfoData;
|
||||
int count = 0;
|
||||
char countBuf[16];
|
||||
DWORD index;
|
||||
DWORD result;
|
||||
|
||||
|
||||
EXDLL_INIT();
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
pushstring("Fatal error!");
|
||||
return;
|
||||
}
|
||||
|
||||
result = FindFirstDevice(hwndParent, &devClass, hwIdBuf, &devInfoSet, &devInfoData,
|
||||
&index, DIGCF_PRESENT);
|
||||
if (result != 0)
|
||||
{
|
||||
pushstring("0");
|
||||
return;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
count++;
|
||||
} while (FindNextDevice(devInfoSet, &devInfoData, &index) == 0);
|
||||
|
||||
SetupDiDestroyDeviceInfoList(devInfoSet);
|
||||
|
||||
wsprintf(countBuf, "%d", count);
|
||||
pushstring(countBuf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* InstDrv::CreateDevice
|
||||
*
|
||||
* Return:
|
||||
* result - Windows error code
|
||||
*/
|
||||
void __declspec(dllexport) CreateDevice(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)
|
||||
{
|
||||
HDEVINFO devInfoSet;
|
||||
SP_DEVINFO_DATA devInfoData;
|
||||
DWORD result = 0;
|
||||
char resultBuf[16];
|
||||
|
||||
|
||||
EXDLL_INIT();
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
pushstring("Fatal error!");
|
||||
return;
|
||||
}
|
||||
|
||||
devInfoSet = SetupDiCreateDeviceInfoList(&devClass, hwndParent);
|
||||
if (devInfoSet == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
wsprintf(resultBuf, "%08X", GetLastError());
|
||||
pushstring(resultBuf);
|
||||
return;
|
||||
}
|
||||
|
||||
devInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
|
||||
if (!SetupDiCreateDeviceInfo(devInfoSet, hwIdBuf, &devClass, NULL,
|
||||
hwndParent, DICD_GENERATE_ID, &devInfoData))
|
||||
{
|
||||
result = GetLastError();
|
||||
goto InstallCleanup;
|
||||
}
|
||||
|
||||
if (!SetupDiSetDeviceRegistryProperty(devInfoSet, &devInfoData, SPDRP_HARDWAREID,
|
||||
hwIdBuf, (lstrlen(hwIdBuf)+2)*sizeof(TCHAR)))
|
||||
{
|
||||
result = GetLastError();
|
||||
goto InstallCleanup;
|
||||
}
|
||||
|
||||
if (!SetupDiCallClassInstaller(DIF_REGISTERDEVICE, devInfoSet, &devInfoData))
|
||||
result = GetLastError();
|
||||
|
||||
InstallCleanup:
|
||||
SetupDiDestroyDeviceInfoList(devInfoSet);
|
||||
|
||||
wsprintf(resultBuf, "%08X", result);
|
||||
pushstring(resultBuf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* InstDrv::InstallDriver infPath
|
||||
*
|
||||
* Return:
|
||||
* result - Windows error code
|
||||
* reboot - non-zero if reboot is required
|
||||
*/
|
||||
void __declspec(dllexport) InstallDriver(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)
|
||||
{
|
||||
char resultBuf[16];
|
||||
BOOL reboot;
|
||||
|
||||
|
||||
EXDLL_INIT();
|
||||
popstring(paramBuf);
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
pushstring("Fatal error!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UpdateDriverForPlugAndPlayDevices(hwndParent, hwIdBuf, paramBuf,
|
||||
INSTALLFLAG_FORCE, &reboot))
|
||||
{
|
||||
wsprintf(resultBuf, "%08X", GetLastError());
|
||||
pushstring(resultBuf);
|
||||
}
|
||||
else
|
||||
{
|
||||
wsprintf(resultBuf, "%d", reboot);
|
||||
pushstring(resultBuf);
|
||||
pushstring("00000000");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* InstDrv::DeleteOemInfFiles
|
||||
*
|
||||
* Return:
|
||||
* result - Windows error code
|
||||
* oeminf - Path of the deleted devices setup file (oemXX.inf)
|
||||
* oempnf - Path of the deleted devices setup file (oemXX.pnf)
|
||||
*/
|
||||
void __declspec(dllexport) DeleteOemInfFiles(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)
|
||||
{
|
||||
HDEVINFO devInfo;
|
||||
SP_DEVINFO_DATA devInfoData;
|
||||
SP_DRVINFO_DATA drvInfoData;
|
||||
SP_DRVINFO_DETAIL_DATA drvInfoDetail;
|
||||
DWORD index;
|
||||
DWORD result;
|
||||
char resultBuf[16];
|
||||
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
pushstring("Fatal error!");
|
||||
return;
|
||||
}
|
||||
|
||||
result = FindFirstDevice(NULL, &devClass, hwIdBuf, &devInfo, &devInfoData, &index, 0);
|
||||
if (result != 0)
|
||||
goto Cleanup1;
|
||||
|
||||
if (!SetupDiBuildDriverInfoList(devInfo, &devInfoData, SPDIT_COMPATDRIVER))
|
||||
{
|
||||
result = GetLastError();
|
||||
goto Cleanup2;
|
||||
}
|
||||
|
||||
drvInfoData.cbSize = sizeof(SP_DRVINFO_DATA);
|
||||
drvInfoDetail.cbSize = sizeof(SP_DRVINFO_DETAIL_DATA);
|
||||
|
||||
if (!SetupDiEnumDriverInfo(devInfo, &devInfoData, SPDIT_COMPATDRIVER, 0, &drvInfoData))
|
||||
{
|
||||
result = GetLastError();
|
||||
goto Cleanup3;
|
||||
}
|
||||
|
||||
if (!SetupDiGetDriverInfoDetail(devInfo, &devInfoData, &drvInfoData,
|
||||
&drvInfoDetail, sizeof(drvInfoDetail), NULL))
|
||||
{
|
||||
result = GetLastError();
|
||||
|
||||
if (result != ERROR_INSUFFICIENT_BUFFER)
|
||||
goto Cleanup3;
|
||||
|
||||
result = 0;
|
||||
}
|
||||
|
||||
pushstring(drvInfoDetail.InfFileName);
|
||||
if (!DeleteFile(drvInfoDetail.InfFileName))
|
||||
result = GetLastError();
|
||||
else
|
||||
{
|
||||
index = lstrlen(drvInfoDetail.InfFileName);
|
||||
if (index > 3)
|
||||
{
|
||||
lstrcpy(drvInfoDetail.InfFileName+index-3, "pnf");
|
||||
pushstring(drvInfoDetail.InfFileName);
|
||||
if (!DeleteFile(drvInfoDetail.InfFileName))
|
||||
result = GetLastError();
|
||||
}
|
||||
}
|
||||
|
||||
Cleanup3:
|
||||
SetupDiDestroyDriverInfoList(devInfo, &devInfoData, SPDIT_COMPATDRIVER);
|
||||
|
||||
Cleanup2:
|
||||
SetupDiDestroyDeviceInfoList(devInfo);
|
||||
|
||||
Cleanup1:
|
||||
wsprintf(resultBuf, "%08X", result);
|
||||
pushstring(resultBuf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* InstDrv::RemoveAllDevices
|
||||
*
|
||||
* Return:
|
||||
* result - Windows error code
|
||||
* reboot - non-zero if reboot is required
|
||||
*/
|
||||
void __declspec(dllexport) RemoveAllDevices(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)
|
||||
{
|
||||
HDEVINFO devInfo;
|
||||
SP_DEVINFO_DATA devInfoData;
|
||||
DWORD index;
|
||||
DWORD result;
|
||||
char resultBuf[16];
|
||||
BOOL reboot = FALSE;
|
||||
SP_DEVINSTALL_PARAMS instParams;
|
||||
|
||||
|
||||
EXDLL_INIT();
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
pushstring("Fatal error!");
|
||||
return;
|
||||
}
|
||||
|
||||
result = FindFirstDevice(NULL, &devClass, hwIdBuf, &devInfo, &devInfoData, &index, 0);
|
||||
if (result != 0)
|
||||
goto Cleanup1;
|
||||
|
||||
do
|
||||
{
|
||||
if (!SetupDiCallClassInstaller(DIF_REMOVE, devInfo, &devInfoData))
|
||||
{
|
||||
result = GetLastError();
|
||||
break;
|
||||
}
|
||||
|
||||
instParams.cbSize = sizeof(instParams);
|
||||
if (!reboot &&
|
||||
SetupDiGetDeviceInstallParams(devInfo, &devInfoData, &instParams) &&
|
||||
((instParams.Flags & (DI_NEEDRESTART|DI_NEEDREBOOT)) != 0))
|
||||
{
|
||||
reboot = TRUE;
|
||||
}
|
||||
|
||||
result = FindNextDevice(devInfo, &devInfoData, &index);
|
||||
} while (result == 0);
|
||||
|
||||
SetupDiDestroyDeviceInfoList(devInfo);
|
||||
|
||||
Cleanup1:
|
||||
if ((result == 0) || (result == ERROR_NO_MORE_ITEMS))
|
||||
{
|
||||
wsprintf(resultBuf, "%d", reboot);
|
||||
pushstring(resultBuf);
|
||||
pushstring("00000000");
|
||||
}
|
||||
else
|
||||
{
|
||||
wsprintf(resultBuf, "%08X", result);
|
||||
pushstring(resultBuf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* InstDrv::StartSystemService serviceName
|
||||
*
|
||||
* Return:
|
||||
* result - Windows error code
|
||||
*/
|
||||
void __declspec(dllexport) StartSystemService(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)
|
||||
{
|
||||
SC_HANDLE managerHndl;
|
||||
SC_HANDLE svcHndl;
|
||||
SERVICE_STATUS svcStatus;
|
||||
DWORD oldCheckPoint;
|
||||
DWORD result;
|
||||
char resultBuf[16];
|
||||
|
||||
|
||||
EXDLL_INIT();
|
||||
popstring(paramBuf);
|
||||
|
||||
managerHndl = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
|
||||
if (managerHndl == NULL)
|
||||
{
|
||||
result = GetLastError();
|
||||
goto Cleanup1;
|
||||
}
|
||||
|
||||
svcHndl = OpenService(managerHndl, paramBuf, SERVICE_START | SERVICE_QUERY_STATUS);
|
||||
if (svcHndl == NULL)
|
||||
{
|
||||
result = GetLastError();
|
||||
goto Cleanup2;
|
||||
}
|
||||
|
||||
if (!StartService(svcHndl, 0, NULL) || !QueryServiceStatus(svcHndl, &svcStatus))
|
||||
{
|
||||
result = GetLastError();
|
||||
goto Cleanup3;
|
||||
}
|
||||
|
||||
while (svcStatus.dwCurrentState == SERVICE_START_PENDING)
|
||||
{
|
||||
oldCheckPoint = svcStatus.dwCheckPoint;
|
||||
|
||||
Sleep(svcStatus.dwWaitHint);
|
||||
|
||||
if (!QueryServiceStatus(svcHndl, &svcStatus))
|
||||
{
|
||||
result = GetLastError();
|
||||
break;
|
||||
}
|
||||
|
||||
if (oldCheckPoint >= svcStatus.dwCheckPoint)
|
||||
{
|
||||
if ((svcStatus.dwCurrentState == SERVICE_STOPPED) &&
|
||||
(svcStatus.dwWin32ExitCode != 0))
|
||||
result = svcStatus.dwWin32ExitCode;
|
||||
else
|
||||
result = ERROR_SERVICE_REQUEST_TIMEOUT;
|
||||
}
|
||||
}
|
||||
|
||||
if (svcStatus.dwCurrentState == SERVICE_RUNNING)
|
||||
result = 0;
|
||||
|
||||
Cleanup3:
|
||||
CloseServiceHandle(svcHndl);
|
||||
|
||||
Cleanup2:
|
||||
CloseServiceHandle(managerHndl);
|
||||
|
||||
Cleanup1:
|
||||
wsprintf(resultBuf, "%08X", result);
|
||||
pushstring(resultBuf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* InstDrv::StopSystemService serviceName
|
||||
*
|
||||
* Return:
|
||||
* result - Windows error code
|
||||
*/
|
||||
void __declspec(dllexport) StopSystemService(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)
|
||||
{
|
||||
SC_HANDLE managerHndl;
|
||||
SC_HANDLE svcHndl;
|
||||
SERVICE_STATUS svcStatus;
|
||||
DWORD oldCheckPoint;
|
||||
DWORD result;
|
||||
char resultBuf[16];
|
||||
|
||||
|
||||
EXDLL_INIT();
|
||||
popstring(paramBuf);
|
||||
|
||||
managerHndl = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
|
||||
if (managerHndl == NULL)
|
||||
{
|
||||
result = GetLastError();
|
||||
goto Cleanup1;
|
||||
}
|
||||
|
||||
svcHndl = OpenService(managerHndl, paramBuf, SERVICE_STOP | SERVICE_QUERY_STATUS);
|
||||
if (svcHndl == NULL)
|
||||
{
|
||||
result = GetLastError();
|
||||
goto Cleanup2;
|
||||
}
|
||||
|
||||
if (!ControlService(svcHndl, SERVICE_CONTROL_STOP, &svcStatus))
|
||||
{
|
||||
result = GetLastError();
|
||||
goto Cleanup3;
|
||||
}
|
||||
|
||||
while (svcStatus.dwCurrentState == SERVICE_STOP_PENDING)
|
||||
{
|
||||
oldCheckPoint = svcStatus.dwCheckPoint;
|
||||
|
||||
Sleep(svcStatus.dwWaitHint);
|
||||
|
||||
if (!QueryServiceStatus(svcHndl, &svcStatus))
|
||||
{
|
||||
result = GetLastError();
|
||||
break;
|
||||
}
|
||||
|
||||
if (oldCheckPoint >= svcStatus.dwCheckPoint)
|
||||
{
|
||||
result = ERROR_SERVICE_REQUEST_TIMEOUT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (svcStatus.dwCurrentState == SERVICE_STOPPED)
|
||||
result = 0;
|
||||
|
||||
Cleanup3:
|
||||
CloseServiceHandle(svcHndl);
|
||||
|
||||
Cleanup2:
|
||||
CloseServiceHandle(managerHndl);
|
||||
|
||||
Cleanup1:
|
||||
wsprintf(resultBuf, "%08X", result);
|
||||
pushstring(resultBuf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOL WINAPI _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
110
altosui/Instdrv/NSIS/Contrib/InstDrv/InstDrv.dsp
Normal file
110
altosui/Instdrv/NSIS/Contrib/InstDrv/InstDrv.dsp
Normal file
@@ -0,0 +1,110 @@
|
||||
# Microsoft Developer Studio Project File - Name="InstDrv" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** NICHT BEARBEITEN **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=InstDrv - Win32 Debug
|
||||
!MESSAGE Dies ist kein g<>ltiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
|
||||
!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und f<>hren Sie den Befehl
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "InstDrv.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE Sie k<>nnen beim Ausf<73>hren von NMAKE eine Konfiguration angeben
|
||||
!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "InstDrv.mak" CFG="InstDrv - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE F<>r die Konfiguration stehen zur Auswahl:
|
||||
!MESSAGE
|
||||
!MESSAGE "InstDrv - Win32 Release" (basierend auf "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "InstDrv - Win32 Debug" (basierend auf "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "InstDrv - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INSTDRV_EXPORTS" /YX /FD /c
|
||||
# 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
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x407 /d "NDEBUG"
|
||||
# ADD RSC /l 0x407 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# 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
|
||||
# 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
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "InstDrv - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# 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
|
||||
# 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
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x407 /d "_DEBUG"
|
||||
# ADD RSC /l 0x407 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# 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
|
||||
# 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
|
||||
# SUBTRACT LINK32 /nodefaultlib
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "InstDrv - Win32 Release"
|
||||
# Name "InstDrv - Win32 Debug"
|
||||
# Begin Group "Quellcodedateien"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\InstDrv.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header-Dateien"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# End Group
|
||||
# Begin Group "Ressourcendateien"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
29
altosui/Instdrv/NSIS/Contrib/InstDrv/InstDrv.dsw
Normal file
29
altosui/Instdrv/NSIS/Contrib/InstDrv/InstDrv.dsw
Normal file
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GEL<45>SCHT WERDEN!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "InstDrv"=.\InstDrv.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
141
altosui/Instdrv/NSIS/Contrib/InstDrv/Readme.txt
Normal file
141
altosui/Instdrv/NSIS/Contrib/InstDrv/Readme.txt
Normal file
@@ -0,0 +1,141 @@
|
||||
InstDrv.dll version 0.2 - Installs or Removes Device Drivers
|
||||
------------------------------------------------------------
|
||||
|
||||
|
||||
The plugin helps you to create NSIS scripts for installing device drivers or
|
||||
removing them again. It can count installed device instances, create new ones
|
||||
or delete all supported device. InstDrv works on Windows 2000 or later.
|
||||
|
||||
|
||||
|
||||
InstDrv::InitDriverSetup devClass drvHWID
|
||||
Return: result
|
||||
|
||||
To start processing a driver, first call this function. devClass is the GUID
|
||||
of the device class the driver supports, drvHWID is the device hardware ID. If
|
||||
you don't know what these terms mean, you may want to take a look at the
|
||||
Windows DDK. This function returns an empty string on success, otherwise an
|
||||
error message.
|
||||
|
||||
InitDriverSetup has to be called every time after the plugin dll has been
|
||||
(re-)loaded, or if you want to switch to a different driver.
|
||||
|
||||
|
||||
|
||||
InstDrv::CountDevices
|
||||
Return: number
|
||||
|
||||
This call returns the number of installed and supported devices of the driver.
|
||||
|
||||
|
||||
|
||||
InstDrv::CreateDevice
|
||||
Return: result
|
||||
|
||||
To create a new deviced node which the driver has to support, use this
|
||||
function. You may even call it multiple times for more than one instance. The
|
||||
return value is the Windows error code (in hex). Use CreateDevice before
|
||||
installing or updating the driver itself.
|
||||
|
||||
|
||||
|
||||
InstDrv::InstallDriver infPath
|
||||
Return: result
|
||||
reboot
|
||||
|
||||
InstallDriver installs or updates a device driver as specified in the .inf
|
||||
setup script. It returns a Windows error code (in hex) and, on success, a flag
|
||||
signalling if a system reboot is required.
|
||||
|
||||
|
||||
|
||||
InstDrv::DeleteOemInfFiles
|
||||
Return: result
|
||||
oeminf
|
||||
oempnf
|
||||
|
||||
DeleteOemInfFiles tries to clean up the Windows inf directory by deleting the
|
||||
oemXX.inf and oemXX.pnf files associated with the drivers. It returns a
|
||||
Windows error code (in hex) and, on success, the names of the deleted files.
|
||||
This functions requires that at least one device instance is still present.
|
||||
So, call it before you remove the devices itself. You should also call it
|
||||
before updating a driver. This avoids that the inf directory gets slowly
|
||||
messed up with useless old setup scripts (which does NOT really accelerate
|
||||
Windows). The error code which comes up when no device is installed is
|
||||
"00000103".
|
||||
|
||||
|
||||
|
||||
InstDrv::RemoveAllDevices
|
||||
Return: result
|
||||
reboot
|
||||
|
||||
This functions deletes all devices instances the driver supported. It returns
|
||||
a Windows error code (in hex) and, on success, a flag signalling if the system
|
||||
needs to be rebooted. You additionally have to remove the driver binaries from
|
||||
the system paths.
|
||||
|
||||
|
||||
|
||||
InstDrv::StartSystemService serviceName
|
||||
Return: result
|
||||
|
||||
Call this function to start the provided system service. The function blocks
|
||||
until the service is started or the system reported a timeout. The return value
|
||||
is the Windows error code (in hex).
|
||||
|
||||
|
||||
|
||||
InstDrv::StopSystemService serviceName
|
||||
Return: result
|
||||
|
||||
This function tries to stop the provided system service. It blocks until the
|
||||
service has been shut down or the system reported a timeout. The return value
|
||||
is the Windows error code (in hex).
|
||||
|
||||
|
||||
|
||||
Example.nsi
|
||||
|
||||
The example script installs or removes the virtual COM port driver of IrCOMM2k
|
||||
(2.0.0-alpha8, see www.ircomm2k.de/english). The driver and its setup script
|
||||
are only included for demonstration purposes, they do not work without the
|
||||
rest of IrCOMM2k (but they also do not cause any harm).
|
||||
|
||||
|
||||
|
||||
Building the Source Code
|
||||
|
||||
To build the plugin from the source code, some include files and libraries
|
||||
which come with the Windows DDK are required.
|
||||
|
||||
|
||||
|
||||
History
|
||||
|
||||
0.2 - fixed bug when calling InitDriverSetup the second time
|
||||
- added StartSystemService and StopSystemService
|
||||
|
||||
0.1 - first release
|
||||
|
||||
|
||||
|
||||
License
|
||||
|
||||
Copyright <20> 2003 Jan Kiszka (Jan.Kiszka@web.de)
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute
|
||||
it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented;
|
||||
you must not claim that you wrote the original software.
|
||||
If you use this software in a product, an acknowledgment in the
|
||||
product documentation would be appreciated but is not required.
|
||||
2. Altered versions must be plainly marked as such,
|
||||
and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any distribution.
|
137
altosui/Instdrv/NSIS/Contrib/InstDrv/ircomm2k.inf
Normal file
137
altosui/Instdrv/NSIS/Contrib/InstDrv/ircomm2k.inf
Normal file
@@ -0,0 +1,137 @@
|
||||
; IrCOMM2k.inf
|
||||
;
|
||||
; Installation file for the Virtual Infrared-COM-Port
|
||||
;
|
||||
; (c) Copyright 2001, 2002 Jan Kiszka
|
||||
;
|
||||
|
||||
[Version]
|
||||
Signature="$Windows NT$"
|
||||
Provider=%JK%
|
||||
Class=Ports
|
||||
ClassGUID={4d36e978-e325-11ce-bfc1-08002be10318}
|
||||
;DriverVer=03/26/2002,1.2.1.0
|
||||
|
||||
[DestinationDirs]
|
||||
IrCOMM2k.Copy2Drivers = 12
|
||||
IrCOMM2k.Copy2Winnt = 10
|
||||
IrCOMM2k.Copy2System32 = 11
|
||||
IrCOMM2k.Copy2Help = 18
|
||||
|
||||
|
||||
;
|
||||
; Driver information
|
||||
;
|
||||
|
||||
[Manufacturer]
|
||||
%JK% = JK.Mfg
|
||||
|
||||
[JK.Mfg]
|
||||
%JK.DeviceDescIrCOMM% = IrCOMM2k_inst,IrCOMM2k
|
||||
|
||||
|
||||
;
|
||||
; General installation section
|
||||
;
|
||||
|
||||
[IrCOMM2k_inst]
|
||||
CopyFiles = IrCOMM2k.Copy2Drivers ;,IrCOMM2k.Copy2System32,IrCOMM2k.Copy2Help,IrCOMM2k.Copy2Winnt
|
||||
;AddReg = IrCOMM2k_inst_AddReg
|
||||
|
||||
|
||||
;
|
||||
; File sections
|
||||
;
|
||||
|
||||
[IrCOMM2k.Copy2Drivers]
|
||||
ircomm2k.sys,,,2
|
||||
|
||||
;[IrCOMM2k.Copy2System32]
|
||||
;ircomm2k.exe,,,2
|
||||
;ircomm2k.dll,,,2
|
||||
|
||||
;[IrCOMM2k.Copy2Help]
|
||||
;ircomm2k.hlp,,,2
|
||||
|
||||
;[IrCOMM2k.Copy2Winnt]
|
||||
;IrCOMM2k-Setup.exe,Setup.exe,,2
|
||||
|
||||
|
||||
;
|
||||
; Service Installation
|
||||
;
|
||||
|
||||
[IrCOMM2k_inst.Services]
|
||||
AddService = IrCOMM2k,0x00000002,IrCOMM2k_DriverService_Inst,IrCOMM2k_DriverEventLog_Inst
|
||||
;AddService = IrCOMM2kSvc,,IrCOMM2k_Service_Inst
|
||||
|
||||
[IrCOMM2k_DriverService_Inst]
|
||||
DisplayName = %IrCOMM2k.DrvName%
|
||||
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
|
||||
StartType = 3 ; SERVICE_DEMAND_START
|
||||
ErrorControl = 0 ; SERVICE_ERROR_IGNORE
|
||||
ServiceBinary = %12%\ircomm2k.sys
|
||||
|
||||
;[IrCOMM2k_Service_Inst]
|
||||
;DisplayName = %IrCOMM2k.SvcName%
|
||||
;Description = %IrCOMM2k.SvcDesc%
|
||||
;ServiceType = 0x00000120 ; SERVICE_WIN32_SHARE_PROCESS, SERVICE_INTERACTIVE_PROCESS
|
||||
;StartType = 2 ; SERVICE_AUTO_START
|
||||
;ErrorControl = 0 ; SERVICE_ERROR_IGNORE
|
||||
;ServiceBinary = %11%\ircomm2k.exe
|
||||
;Dependencies = IrCOMM2k
|
||||
;AddReg = IrCOMM2kSvcAddReg
|
||||
|
||||
|
||||
[IrCOMM2k_inst.nt.HW]
|
||||
AddReg=IrCOMM2kHwAddReg
|
||||
|
||||
[IrCOMM2kHwAddReg]
|
||||
HKR,,PortSubClass,REG_BINARY,0x00000001
|
||||
;HKR,,TimeoutScaling,REG_DWORD,0x00000001
|
||||
;HKR,,StatusLines,REG_DWORD,0x00000000
|
||||
|
||||
;[IrCOMM2k_inst_AddReg]
|
||||
;HKR,,EnumPropPages32,,"ircomm2k.dll,IrCOMM2kPropPageProvider"
|
||||
;HKLM,%UNINSTALL_KEY%,DisplayIcon,0x00020000,"%windir%\IrCOMM2k-Setup.exe"
|
||||
;HKLM,%UNINSTALL_KEY%,DisplayName,,"IrCOMM2k 1.2.1 "
|
||||
;HKLM,%UNINSTALL_KEY%,DisplayVersion,,"1.2.1"
|
||||
;HKLM,%UNINSTALL_KEY%,HelpLink,,"http://www.ircomm2k.de"
|
||||
;HKLM,%UNINSTALL_KEY%,Publisher,,%JK%
|
||||
;HKLM,%UNINSTALL_KEY%,UninstallString,0x00020000,"%windir%\IrCOMM2k-Setup.exe"
|
||||
|
||||
;[IrCOMM2kSvcAddReg]
|
||||
;HKR,Parameters,ActiveConnectOnly,REG_DWORD,0x00000000
|
||||
|
||||
|
||||
[IrCOMM2k_DriverEventLog_Inst]
|
||||
AddReg = IrCOMM2k_DriverEventLog_AddReg
|
||||
|
||||
[IrCOMM2k_DriverEventLog_AddReg]
|
||||
HKR,,EventMessageFile,REG_EXPAND_SZ,"%SystemRoot%\System32\IoLogMsg.dll;%SystemRoot%\System32\drivers\ircomm2k.sys"
|
||||
HKR,,TypesSupported,REG_DWORD,7
|
||||
|
||||
|
||||
[Strings]
|
||||
|
||||
;
|
||||
; Non-Localizable Strings
|
||||
;
|
||||
|
||||
REG_SZ = 0x00000000
|
||||
REG_MULTI_SZ = 0x00010000
|
||||
REG_EXPAND_SZ = 0x00020000
|
||||
REG_BINARY = 0x00000001
|
||||
REG_DWORD = 0x00010001
|
||||
SERVICEROOT = "System\CurrentControlSet\Services"
|
||||
UNINSTALL_KEY = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\IrCOMM2k"
|
||||
|
||||
;
|
||||
; Localizable Strings
|
||||
;
|
||||
|
||||
JK = "Jan Kiszka"
|
||||
JK.DeviceDescIrCOMM = "Virtueller Infrarot-Kommunikationsanschluss"
|
||||
IrCOMM2k.DrvName = "Virtueller Infrarot-Kommunikationsanschluss"
|
||||
;IrCOMM2k.SvcName = "Virtueller Infrarot-Kommunikationsanschlu<6C>, Dienstprogramm"
|
||||
;IrCOMM2k.SvcDesc = "Bildet <20>ber Infarot einen Kommunikationsanschlu<6C> nach."
|
BIN
altosui/Instdrv/NSIS/Contrib/InstDrv/ircomm2k.sys
Normal file
BIN
altosui/Instdrv/NSIS/Contrib/InstDrv/ircomm2k.sys
Normal file
Binary file not shown.
181
altosui/Instdrv/NSIS/Includes/java.nsh
Normal file
181
altosui/Instdrv/NSIS/Includes/java.nsh
Normal file
@@ -0,0 +1,181 @@
|
||||
!include WordFunc.nsh
|
||||
|
||||
; Definitions for Java Detection
|
||||
|
||||
!define JAVA_VERSION "6.0"
|
||||
|
||||
Function GetFileVersion
|
||||
!define GetFileVersion `!insertmacro GetFileVersionCall`
|
||||
|
||||
!macro GetFileVersionCall _FILE _RESULT
|
||||
Push `${_FILE}`
|
||||
Call GetFileVersion
|
||||
Pop ${_RESULT}
|
||||
!macroend
|
||||
|
||||
Exch $0
|
||||
Push $1
|
||||
Push $2
|
||||
Push $3
|
||||
Push $4
|
||||
Push $5
|
||||
Push $6
|
||||
ClearErrors
|
||||
|
||||
GetDllVersion '$0' $1 $2
|
||||
IfErrors error
|
||||
IntOp $3 $1 >> 16
|
||||
IntOp $3 $3 & 0x0000FFFF
|
||||
IntOp $4 $1 & 0x0000FFFF
|
||||
IntOp $5 $2 >> 16
|
||||
IntOp $5 $5 & 0x0000FFFF
|
||||
IntOp $6 $2 & 0x0000FFFF
|
||||
StrCpy $0 '$3.$4.$5.$6'
|
||||
goto end
|
||||
|
||||
error:
|
||||
SetErrors
|
||||
StrCpy $0 ''
|
||||
|
||||
end:
|
||||
Pop $6
|
||||
Pop $5
|
||||
Pop $4
|
||||
Pop $3
|
||||
Pop $2
|
||||
Pop $1
|
||||
Exch $0
|
||||
FunctionEnd
|
||||
|
||||
Function openLinkNewWindow
|
||||
Push $3
|
||||
Exch
|
||||
Push $2
|
||||
Exch
|
||||
Push $1
|
||||
Exch
|
||||
Push $0
|
||||
Exch
|
||||
|
||||
ReadRegStr $1 HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html\UserChoice" "Progid"
|
||||
IfErrors iexplore
|
||||
|
||||
Goto foundbrowser
|
||||
iexplore:
|
||||
StrCpy $1 "IE.AssocFile.HTM"
|
||||
|
||||
foundbrowser:
|
||||
|
||||
StrCpy $2 "\shell\open\command"
|
||||
|
||||
StrCpy $3 $1$2
|
||||
|
||||
ReadRegStr $0 HKCR $3 ""
|
||||
|
||||
# Get browser path
|
||||
DetailPrint $0
|
||||
|
||||
StrCpy $2 '"'
|
||||
StrCpy $1 $0 1
|
||||
StrCmp $1 $2 +2 # if path is not enclosed in " look for space as final char
|
||||
StrCpy $2 ' '
|
||||
StrCpy $3 1
|
||||
loop:
|
||||
StrCpy $1 $0 1 $3
|
||||
DetailPrint $1
|
||||
StrCmp $1 $2 found
|
||||
StrCmp $1 "" found
|
||||
IntOp $3 $3 + 1
|
||||
Goto loop
|
||||
|
||||
found:
|
||||
StrCpy $1 $0 $3
|
||||
StrCmp $2 " " +2
|
||||
StrCpy $1 '$1"'
|
||||
|
||||
Pop $0
|
||||
Exec '$1 $0'
|
||||
Pop $0
|
||||
Pop $1
|
||||
Pop $2
|
||||
Pop $3
|
||||
FunctionEnd
|
||||
|
||||
!macro _OpenURL URL
|
||||
Push "${URL}"
|
||||
Call openLinkNewWindow
|
||||
!macroend
|
||||
|
||||
!define OpenURL '!insertmacro "_OpenURL"'
|
||||
|
||||
Function DoDetectJRE
|
||||
|
||||
DetailPrint "Desired Java version ${JAVA_VERSION}"
|
||||
|
||||
SearchPath $0 javaw.exe
|
||||
IfErrors no
|
||||
|
||||
DetailPrint "Detected java in $0"
|
||||
|
||||
${GetFileVersion} "$0" $1
|
||||
IfErrors no
|
||||
|
||||
DetailPrint "Java version $1"
|
||||
|
||||
${VersionCompare} $1 ${JAVA_VERSION} $2
|
||||
IntCmp $2 1 yes yes old
|
||||
|
||||
yes:
|
||||
StrCpy $0 2
|
||||
Goto done
|
||||
|
||||
old:
|
||||
StrCpy $0 1
|
||||
Goto done
|
||||
|
||||
no:
|
||||
StrCpy $0 0
|
||||
Goto done
|
||||
|
||||
done:
|
||||
|
||||
FunctionEnd
|
||||
|
||||
var dialog
|
||||
var hwnd
|
||||
var null
|
||||
|
||||
var install
|
||||
var quit
|
||||
var skip
|
||||
|
||||
Function GetJRE
|
||||
${OpenURL} "adoptium.net"
|
||||
MessageBox MB_OK "Click OK to continue after completing the Java Install."
|
||||
FunctionEnd
|
||||
|
||||
Function DetectJRE
|
||||
|
||||
Call DoDetectJRE
|
||||
|
||||
IntCmp $0 1 ask_old ask_no yes
|
||||
|
||||
ask_no:
|
||||
StrCpy $0 "Cannot find Java. Download and install?"
|
||||
Goto ask
|
||||
|
||||
ask_old:
|
||||
StrCpy $0 "Java version appears to be too old. Download and install?"
|
||||
Goto ask
|
||||
|
||||
ask:
|
||||
MessageBox MB_YESNOCANCEL $0 IDYES do_java IDNO skip_java
|
||||
|
||||
do_java:
|
||||
Call GetJRE
|
||||
|
||||
|
||||
skip_java:
|
||||
yes:
|
||||
|
||||
FunctionEnd
|
14
altosui/Instdrv/NSIS/Includes/refresh-sh.nsh
Normal file
14
altosui/Instdrv/NSIS/Includes/refresh-sh.nsh
Normal file
@@ -0,0 +1,14 @@
|
||||
!define SHCNE_ASSOCCHANGED 0x08000000
|
||||
!define SHCNF_IDLIST 0
|
||||
|
||||
Function RefreshShellIcons
|
||||
; By jerome tremblay - april 2003
|
||||
${DisableX64FSRedirection}
|
||||
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)'
|
||||
FunctionEnd
|
||||
|
||||
Function un.RefreshShellIcons
|
||||
; By jerome tremblay - april 2003
|
||||
${DisableX64FSRedirection}
|
||||
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)'
|
||||
FunctionEnd
|
Reference in New Issue
Block a user