int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { MSG msg; HWND hPTV; char szDriverPath[0x400]; GetDriverPath(NULL, szDriverPath, sizeof(szDriverPath) / sizeof(char)); hDriverFile = CreateDriverFile(DEVICE_NAME, CheckExecutingSameProcess() ? NULL : DRIVER_NAME, szDriverPath); hPTV = CreatePTViewerWindow(hInstance); while (GetMessage(&msg, NULL, 0, 0) > 0){ if (IsDialogMessage(hPTV, &msg)) continue; TranslateMessage(&msg); DispatchMessage(&msg); } CloseDriverFile(hDriverFile, CheckExecutingSameProcess() ? NULL : DRIVER_NAME); if (hProcessEv != INVALID_HANDLE_VALUE) CloseHandle(hProcessEv); return 0; }
bool _stdcall InitializeWinIo() { bool bResult; DWORD dwBytesReturned; IsNT = IsWinNT(); if (IsNT) { hDriver = CreateFile("\\\\.\\WINIO", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); // If the driver is not running, install it if (hDriver == INVALID_HANDLE_VALUE) { GetDriverPath(); bResult = InstallWinIoDriver(szWinIoDriverPath, true); if (!bResult) return false; bResult = StartWinIoDriver(); if (!bResult) return false; hDriver = CreateFile("\\\\.\\WINIO", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hDriver == INVALID_HANDLE_VALUE) return false; } // Enable I/O port access for this process if (!DeviceIoControl(hDriver, IOCTL_WINIO_ENABLEDIRECTIO, NULL, 0, NULL, 0, &dwBytesReturned, NULL)) return false; } else { VxDCall = (DWORD (WINAPI *)(DWORD,DWORD,DWORD))GetK32ProcAddress(1); hDriver = CreateFile("\\\\.\\WINIO.VXD", 0, 0, 0, CREATE_NEW, FILE_FLAG_DELETE_ON_CLOSE, 0); if (hDriver == INVALID_HANDLE_VALUE) return false; } IsWinIoInitialized = true; return true; }
INT32 __stdcall start( ) { HANDLE sectionHandle, *hMutex; HANDLE eventHandle; HANDLE threadHandle; DWORD sectionSize; MSG messages; OBJECT_ATTRIBUTES objAttrib = {0}; PTEB threadEnvironmentBlock; UNICODE_STRING eventSource; LDR_DATA_TABLE_ENTRY *module; SECTION_BASIC_INFORMATION sectionInfo; LARGE_INTEGER newSectionSize; InitializeCRT(); threadEnvironmentBlock = NtCurrentTeb(); PushProcessId = threadEnvironmentBlock->ClientId.UniqueProcess; PushHeapHandle = threadEnvironmentBlock->ProcessEnvironmentBlock->ProcessHeap; PushSessionId = threadEnvironmentBlock->ProcessEnvironmentBlock->SessionId; // Check if already running hMutex = CreateMutexW(0, FALSE, L"PushOneInstance"); if (threadEnvironmentBlock->LastErrorValue == ERROR_ALREADY_EXISTS || threadEnvironmentBlock->LastErrorValue == ERROR_ACCESS_DENIED) { MessageBoxW(0, L"Only one instance!", 0,0); ExitProcess(0); } //create image event eventHandle = NULL; UnicodeString_Init(&eventSource, L"Global\\" PUSH_IMAGE_EVENT_NAME); objAttrib.Length = sizeof(OBJECT_ATTRIBUTES); objAttrib.RootDirectory = BaseGetNamedObjectDirectory(); objAttrib.ObjectName = &eventSource; objAttrib.Attributes = OBJ_OPENIF; objAttrib.SecurityDescriptor = NULL; objAttrib.SecurityQualityOfService = NULL; NtCreateEvent(&eventHandle, EVENT_ALL_ACCESS, &objAttrib, NotificationEvent, FALSE); // populate file name and path module = (LDR_DATA_TABLE_ENTRY*)threadEnvironmentBlock->ProcessEnvironmentBlock->Ldr->InLoadOrderModuleList.Flink; Memory_Copy(PushFilePath, module->FullDllName.Buffer, module->FullDllName.Length); PushFilePath[module->FullDllName.Length] = L'\0'; // Start Driver. Driver_Extract(); PushDriverLoaded = Driver_Load(); //initialize instance PushInstance = Module_GetHandle(L"Push.exe"); // Create interface MwCreateMainWindow(); // Create section. sectionSize = sizeof(PUSH_SHARED_MEMORY) + OSD_GetSize(); PushSharedMemory = (PUSH_SHARED_MEMORY*)Memory_MapViewOfSection(PUSH_SECTION_NAME, sectionSize, §ionHandle); if (!PushSharedMemory) { Log(L"Could not create shared memory"); return 0; } Log(L"Created section of size %i bytes", sectionSize); //zero struct Memory_Clear(PushSharedMemory, sizeof(PUSH_SHARED_MEMORY)); //initialize window handle used by overlay //PushSharedMemory->WindowHandle = PushMainWindow->Handle; //initialize default font properties for overlay String_Copy(PushSharedMemory->FontName, L"Verdana"); PushSharedMemory->FontBold = TRUE; if (File_Exists(PUSH_SETTINGS_FILE)) { wchar_t *buffer; wchar_t marker; // Check if file is UTF-16LE. buffer = (WCHAR*) File_Load(PUSH_SETTINGS_FILE, NULL); marker = buffer[0]; Memory_Free(buffer); if (marker == 0xFEFF) //is UTF-LE. { // Init settings from ini file. buffer = Memory_Allocate(100 * sizeof(WCHAR)); Ini_GetString(L"Settings", L"FrameLimit", NULL, buffer, 5, L".\\" PUSH_SETTINGS_FILE); PushSharedMemory->FrameLimit = _wtoi(buffer); if (Ini_ReadBoolean(L"Settings", L"ThreadOptimization", FALSE, L".\\" PUSH_SETTINGS_FILE)) PushSharedMemory->ThreadOptimization = TRUE; if (Ini_ReadBoolean(L"Settings", L"KeepFps", FALSE, L".\\" PUSH_SETTINGS_FILE)) PushSharedMemory->KeepFps = TRUE; Ini_GetString(L"Settings", L"OverlayInterface", NULL, buffer, 5, L".\\" PUSH_SETTINGS_FILE); if (String_Compare(buffer, L"PURE") == 0) PushOverlayInterface = OVERLAY_INTERFACE_PURE; else if (String_Compare(buffer, L"RTSS") == 0) PushOverlayInterface = OVERLAY_INTERFACE_RTSS; Ini_GetString(L"Settings", L"KeyboardHookType", L"AUTO", buffer, 10, L".\\" PUSH_SETTINGS_FILE); if (String_Compare(buffer, L"AUTO") == 0) { PushSharedMemory->KeyboardHookType = KEYBOARD_HOOK_AUTO; } else if (String_Compare(buffer, L"SUBCLASS") == 0) { PushSharedMemory->KeyboardHookType = KEYBOARD_HOOK_SUBCLASS; } else if (String_Compare(buffer, L"MESSAGE") == 0) { PushSharedMemory->KeyboardHookType = KEYBOARD_HOOK_MESSAGE; } else if (String_Compare(buffer, L"KEYBOARD") == 0) { PushSharedMemory->KeyboardHookType = KEYBOARD_HOOK_KEYBOARD; } else if (String_Compare(buffer, L"DETOURS") == 0) { PushSharedMemory->KeyboardHookType = KEYBOARD_HOOK_DETOURS; } else if (String_Compare(buffer, L"RAW") == 0) { PushSharedMemory->KeyboardHookType = KEYBOARD_HOOK_RAW; } else { PushSharedMemory->KeyboardHookType = KEYBOARD_HOOK_AUTO; } Ini_GetString(L"Settings", L"EngineClockMax", NULL, buffer, 5, L".\\" PUSH_SETTINGS_FILE); PushSharedMemory->HarwareInformation.DisplayDevice.EngineOverclock = _wtoi(buffer); Ini_GetString(L"Settings", L"MemoryClockMax", NULL, buffer, 5, L".\\" PUSH_SETTINGS_FILE); PushSharedMemory->HarwareInformation.DisplayDevice.MemoryOverclock = _wtoi(buffer); Ini_GetString(L"Settings", L"ControllerTimeout", NULL, buffer, 5, L".\\" PUSH_SETTINGS_FILE); PushSharedMemory->ControllerTimeout = _wtoi(buffer); Ini_GetString(L"Settings", L"FontName", L"Verdana", buffer, 100, L".\\" PUSH_SETTINGS_FILE); String_Copy(PushSharedMemory->FontName, buffer); Memory_Free(buffer); if (Ini_ReadBoolean(L"Settings", L"FontBold", FALSE, L".\\" PUSH_SETTINGS_FILE)) PushSharedMemory->FontBold = TRUE; } else { MessageBoxW( NULL, L"Settings file not UTF-16LE! " L"Resave the file as \"Unicode\" or Push won't read it!", L"Bad Settings file", NULL ); } } if (!PushDriverLoaded) { wchar_t driverPath[260]; Resource_Extract(L"DRIVERALT", L"WinRing0x64.sys"); GetDriverPath(L"WinRing0x64.sys", driverPath); Wr0DriverLoaded = Wr0Initialize(driverPath); } //initialize HWInfo GetHardwareInfo(); //initialize OSD items NtQuerySection( sectionHandle, SectionBasicInformation, §ionInfo, sizeof(SECTION_BASIC_INFORMATION), NULL ); newSectionSize.QuadPart = OSD_Initialize() + sizeof(PUSH_SHARED_MEMORY); if (newSectionSize.QuadPart > sectionInfo.MaximumSize.QuadPart) { Log(L"Shared memory too small!"); } //Check for controllers/gamepads/bluetooth adapters //EnumerateDevices(); // Check for running games Process_EnumProcesses(ProcessEnum); // Activate process monitoring if (PushDriverLoaded) { PushToggleProcessMonitoring(TRUE); } else { HANDLE overlayLib = NULL; void* prcAddress = 0; Resource_Extract(L"OVERLAY32", PUSH_LIB_NAME_32); overlayLib = Module_Load(L"overlay32.dll"); prcAddress = Module_GetProcedureAddress(overlayLib, "InstallOverlayHook"); if (prcAddress) { InstallOverlayHook = (TYPE_InstallOverlayHook)prcAddress; InstallOverlayHook(); } } g_szPrevGame[5] = '\0'; NtCreateThreadEx( &PushMonitorThreadHandle, THREAD_ALL_ACCESS, NULL, NtCurrentProcess(), &MonitorThread, NULL, NoThreadFlags, 0, 0, 0, NULL ); NtCreateThreadEx( &threadHandle, THREAD_ALL_ACCESS, NULL, NtCurrentProcess(), &PipeThread, NULL, NoThreadFlags, 0, 0, 0, NULL ); // Handle messages while(GetMessageW(&messages, 0,0,0)) { TranslateMessage(&messages); DispatchMessageW(&messages); } ExitProcess(0); return 0; }
/************************************* * int _cdecl main( ) * 功能 加载驱动,进行控制 **************************************/ int _cdecl main() { HANDLE hDevice; BOOL bRc; ULONG bytesReturned; DWORD errNum = 0; UCHAR driverLocation[MAX_PATH]; SC_HANDLE schSCManager;// 服务控制器句柄 // 打开服务控制器,后续安装、启动都会使用到。 schSCManager = OpenSCManager(NULL, // 本机 NULL, // 本机数据库 SC_MANAGER_ALL_ACCESS // 存取权限 ); if (!schSCManager) { // 打开失败 printf("Open SC Manager failed! Error = %d \n", GetLastError()); return 1; } // 获得驱动文件的路径 if (!GetDriverPath(driverLocation)) { return 1; } // 安装驱动服务 if (InstallDriver(schSCManager, DRIVER_NAME, driverLocation )) { // 安装成功,启动服务,运行驱动 if(!StartDriver(schSCManager, DRIVER_NAME )) { printf("Unable to start driver. \n"); return 1; } } else { // 安装失败,删除驱动。 RemoveDriver(schSCManager, DRIVER_NAME ); printf("Unable to install driver. \n"); return 1; } // 打开驱动,获得控制所用的句柄 // 由驱动创建的符号链接 hDevice = CreateFile( "\\\\.\\IoctlTest", GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if ( hDevice == INVALID_HANDLE_VALUE ) { printf ( "Error: CreatFile Failed : %d\n", GetLastError()); return 1; } // 打印,输入输出。 printf("InputBuffer Pointer = %p, BufLength = %d\n", InputBuffer, sizeof(InputBuffer)); printf("OutputBuffer Pointer = %p BufLength = %d\n", OutputBuffer, sizeof(OutputBuffer)); // 输入到内核的数据, lstrcpy(InputBuffer, "This String is from User Application; using IOCTL_XIOCTL_BUFFER"); printf("\nCalling DeviceIoControl IOCTL_XIOCTL_BUFFER:\n"); // 清空输出缓存 memset(OutputBuffer, 0, sizeof(OutputBuffer)); // 进行IO控制, bRc = DeviceIoControl ( hDevice,// 句柄 (DWORD) IOCTL_XIOCTL_BUFFER,// IOCTL &InputBuffer,// 输入数据 strlen ( InputBuffer )+1,// 输入数据的长度 &OutputBuffer,// 输出数据 sizeof( OutputBuffer),// 输出数据长度 &bytesReturned,// 实际输出的数据长度 NULL ); // 判断是否成功 if ( !bRc ) { printf ( "Error in DeviceIoControl : %d", GetLastError()); return 1; } // 打印从内核输出的内容 printf(" OutBuffer (%d): %s\n", bytesReturned, OutputBuffer); // 关闭句柄 CloseHandle ( hDevice ); // 停止运行 StopDriver(schSCManager, DRIVER_NAME ); // 删除服务 RemoveDriver(schSCManager, DRIVER_NAME ); // 关闭服务控制器 CloseServiceHandle (schSCManager); return 0; }
void main(int argc,char *argv[]) { HMQ hmqQueue; QMSG qmsgMessage; ULONG flCreate; LONG lIndex; char szString[80]; int iIndex; HFILE hCom; APIRET rc; ULONG ulAction; ULONG cbDataSize = sizeof(ULONG); if (argc >= 2) { for (lIndex = 1;lIndex < argc;lIndex++) { if ((argv[lIndex][0] == '/') || (argv[lIndex][0] == '-')) { switch (argv[lIndex][1] & 0xdf) { case 'X': bDebug = TRUE; break; default: strcpy(szDemoPath,&argv[lIndex][1]); bInstallDemo = TRUE; break; } } } } stInst.hab = WinInitialize((USHORT)NULL); hmqQueue = WinCreateMsgQueue(stInst.hab,0); WinRegisterClass(stInst.hab, "INSTALL", (PFNWP)fnwpClient, 0L, 4); DosQuerySysInfo(QSV_MAX_PATH_LENGTH,QSV_MAX_PATH_LENGTH,&stInst.ulMaxPathLen,sizeof(ULONG)); MemAlloc(&pszPath,((stInst.ulMaxPathLen * 3) + 20)); MemAlloc(&stInst.paszStrings[CONFIGDDLIBRARYSPEC],(stInst.ulMaxPathLen + 1)); MemAlloc(&stInst.pszSourceIniPath,(stInst.ulMaxPathLen + 1)); MemAlloc(&stInst.paszStrings[CURRENTDRIVERSPEC],(stInst.ulMaxPathLen + 1)); MemAlloc(&stInst.paszStrings[DRIVERINISPEC],(stInst.ulMaxPathLen + 1)); MemAlloc(&stInst.paszStrings[XFERLIBRARYSPEC],(stInst.ulMaxPathLen + 1)); MemAlloc(&stInst.pszDLLpath,(stInst.ulMaxPathLen + 1)); MemAlloc(&stInst.pszAppsPath,(stInst.ulMaxPathLen + 1)); MemAlloc(&pszUninstallIniPath,(stInst.ulMaxPathLen + 1)); MemAlloc(&pszCurrentAppsPath,(stInst.ulMaxPathLen + 1)); MemAlloc(&stInst.pszSourcePath,(stInst.ulMaxPathLen + 1)); MemAlloc(&pszHelpFileSpec,(stInst.ulMaxPathLen + 1)); MemAlloc(&stCOMiCFG.pszDriverIniSpec,(stInst.ulMaxPathLen + 1)); MemAlloc(&stInst.paszStrings[CONFIGAPPLIBRARYSPEC],(stInst.ulMaxPathLen + 1)); DosQuerySysInfo(QSV_BOOT_DRIVE,QSV_BOOT_DRIVE,&ulBootDrive,sizeof(ULONG)); stInst.chBootDrive = ('A' + (char)ulBootDrive - 1); if (bDebug) PrintDebug("Debug Messaging","is enabled"); if ((rc = DosOpen(SPECIAL_DEVICE,&hCom,&ulAction,0L,0L,0x0001,0x21c2,0L)) == 0) { if ((GetDriverPath(hCom,pszPath)) && (pszPath[1] == ':')) { for (iIndex = 0;iIndex < stInst.ulMaxPathLen;iIndex++) { if (pszPath[iIndex] == ' ') break; pszPath[iIndex] = toupper(pszPath[iIndex]); } strcpy(szDriverVersionString,&pszPath[iIndex + 1]); szDriverVersionString[strlen(szDriverVersionString) - 3] = 0; pszPath[iIndex] = 0; strcpy(stInst.paszStrings[CURRENTDRIVERSPEC],pszPath); MemAlloc(&stInst.paszStrings[REMOVEOLDDRIVERSPEC],(stInst.ulMaxPathLen + 1)); strcpy(stInst.paszStrings[REMOVEOLDDRIVERSPEC],pszPath); strcpy(stInst.paszStrings[DRIVERINISPEC],pszPath); AppendINI(stInst.paszStrings[DRIVERINISPEC]); SetEndOfPath(pszPath); strcpy(stInst.pszDLLpath,pszPath); strcpy(stInst.pszAppsPath,pszPath); sprintf(pszUninstallIniPath,"%s\\%s",pszPath,szUninstallIniFileName); bCOMiInstalled = TRUE; bItemOneLocked = FALSE; } DosClose(hCom); } strcpy(stInst.pszSourcePath,argv[0]); SetEndOfPath(stInst.pszSourcePath); sprintf(pszHelpFileSpec,"%s\\%s",stInst.pszSourcePath,szHelpFileName); if (bInstallDemo) { if (szDemoPath[strlen(szDemoPath) - 1] =='\\') szDemoPath[iIndex - 1] = 0; strncpy(pszPath,stInst.pszSourcePath,3); iIndex = 3; if (pszPath[2] != '\\') { iIndex = 2; pszPath[2] = '\\'; } sprintf(&pszPath[3],"%s\\%s",szDemoPath,&stInst.pszSourcePath[iIndex]); strcpy(stInst.pszSourcePath,pszPath); } sprintf(stInst.pszSourceIniPath,"%s\\%s",stInst.pszSourcePath,szIniFileName); if (bDebug) PrintDebug("Source Ini File",stInst.pszSourceIniPath); stInst.bCopyCOMscope = TRUE; stInst.bCopyPager = TRUE; stInst.bCopyCOMi = TRUE; stInst.bCreateObjects = TRUE; #ifdef this_junk stInst.bCopyInstall = TRUE; stInst.bCopyUtil = TRUE; stInst.bCopyPDR = TRUE; stInst.bCopyLibraries = TRUE; #endif hSourceProfile = PrfOpenProfile(stInst.hab,stInst.pszSourceIniPath); if (hSourceProfile != 0) { PrfQueryProfileString(hSourceProfile,"Install","False Start 1",0,szFalseStart1,400); PrfQueryProfileString(hSourceProfile,"Install","False Start 2",0,szFalseStart2,400); if (!PrfQueryProfileData(hSourceProfile,"Install","bConfigurationOnly",&bConfigurationOnly,&cbDataSize)) bConfigurationOnly = FALSE; PrfQueryProfileString(hSourceProfile,"COMi","Driver","COMDD.SYS",szDDname,18); PrfQueryProfileString(hSourceProfile,"COMi","Version",0,szCOMiVersion,60); PrfQueryProfileString(hSourceProfile,"COMscope","Version",0,szCOMscopeVersion,60); PrfQueryProfileString(hSourceProfile,"Pager","Pager File","PAGERDEF.PAG",szPagerFileName,20); PrfQueryProfileString(hSourceProfile,"Pager","Version",0,szAppVersion,60); PrfQueryProfileString(hSourceProfile,"Pager","Icon File",0,szAppIconFile,60); PrfQueryProfileString(hSourceProfile,"Install","Banner One","for the",szBannerOne,MAX_BANNER); PrfQueryProfileString(hSourceProfile,"Install","Banner Two","COMi Device Driver",szBannerTwo,MAX_BANNER); PrfQueryProfileString(hSourceProfile,"Install","Title","COMi Device Driver Install",szEXEtitle,60); PrfQueryProfileString(hSourceProfile,"Install","DD Name","COMi",szConfigDDname,20); PrfQueryProfileString(hSourceProfile,"Install","App Name",0,szConfigAppName,20); PrfQueryProfileString(hSourceProfile,"Install","Apps Path","C:\\COMM",szDefaultAppsPath,60); PrfQueryProfileString(hSourceProfile,"Install","Libs Path","C:\\COMM",szDefaultDLLpath,60); PrfQueryProfileString(hSourceProfile,"Install","Version",0,szInstallVersion,60); PrfQueryProfileString(hSourceProfile,"Install","Info File",0,szInfoFileName,20); PrfQueryProfileString(hSourceProfile,"Install","Info Caption",0,szInfoCaption,60); PrfQueryProfileString(hSourceProfile,"Install","License File",0,szLicenseFileName,20); PrfQueryProfileString(hSourceProfile,"Install","License Caption",0,szLicenseCaption,60); PrfQueryProfileString(hSourceProfile,"Install","Check Caption One",0,szCheckOneCaption,60); PrfQueryProfileString(hSourceProfile,"Install","Check Caption Two",0,szCheckTwoCaption,60); PrfQueryProfileString(hSourceProfile,"Install","Check Caption Three",0,szCheckThreeCaption,60); PrfQueryProfileString(hSourceProfile,"Install","Check Caption Four",0,szCheckFourCaption,60); PrfQueryProfileString(hSourceProfile,"Install","Check Caption Five",0,szCheckFiveCaption,60); PrfQueryProfileString(hSourceProfile,"Install","DD Config Help","COMscope.HLP",szConfigDDhelpFileName,60); PrfQueryProfileString(hSourceProfile,"Install","App Config Help",0,szConfigAppHelpFileName,60); PrfQueryProfileString(hSourceProfile,"Install","DD Config Library",COMi_CONFIG_LIB,szConfigDDlibraryName,60); PrfQueryProfileString(hSourceProfile,"Install","DD Config Function","InstallDevice",szConfigDDfunctionName,60); PrfQueryProfileString(hSourceProfile,"Install","Transfer Library",COMi_INSTALL_LIB,szTransferLibraryName,60); sprintf(stInst.paszStrings[XFERLIBRARYSPEC],"%s\\%s.DLL",stInst.pszSourcePath,szTransferLibraryName); PrfQueryProfileString(hSourceProfile,"Install","Transfer Function","TransferFiles",szTransferFunctionName,60); PrfQueryProfileString(hSourceProfile,"Install","App Config Library",0,szConfigAppLibraryName,60); PrfQueryProfileString(hSourceProfile,"Install","App Config Function",0,szConfigAppFunctionName,60); if (!PrfQueryProfileData(hSourceProfile,"COMi","OEM_type",&ulOEMtype,&cbDataSize)) ulOEMtype = 0; if (!PrfQueryProfileData(hSourceProfile,"COMi","Max Device Count",&stCOMiCFG.ulMaxDeviceCount,&cbDataSize)) stCOMiCFG.ulMaxDeviceCount = 0; if (!PrfQueryProfileData(hSourceProfile,"COMscope","ProgramSize",&ulCOMscopeSize,&cbDataSize)) { stInst.bCopyCOMscope = FALSE; bCOMscopeToInstall = FALSE; } if (!PrfQueryProfileData(hSourceProfile,"Pager","ProgramSize",&ulPagerSize,&cbDataSize)) { stInst.bCopyPager = FALSE; bPagerToInstall = FALSE; } if (!PrfQueryProfileData(hSourceProfile,"COMi","ProgramSize",&ulCOMiSize,&cbDataSize)) { stInst.bCopyCOMi = FALSE; bCOMiToInstall = FALSE; } if (!PrfQueryProfileData(hSourceProfile,"Install","ProgramSize",&ulInstallSize,&cbDataSize)) { stInst.bCopyInstall = FALSE; bInstallToInstall = FALSE; } if (!PrfQueryProfileData(hSourceProfile,"Utilities","ProgramSize",&ulUtilSize,&cbDataSize)) { stInst.bCopyUtil = FALSE; bUtilToInstall = FALSE; } if (!PrfQueryProfileData(hSourceProfile,"PDR","ProgramSize",&ulPDRsize,&cbDataSize)) { stInst.bCopyPDR = FALSE; bPDRtoInstall = FALSE; } if (!PrfQueryProfileData(hSourceProfile,"Libraries","ProgramSize",&ulLibsSize,&cbDataSize)) { stInst.bCopyLibraries = FALSE; bLibrariesToInstall = FALSE; } if (!stInst.bCopyCOMscope) stInst.bCopyInstall = TRUE; } else exit(55); if (!bCOMiInstalled) { if (strlen(szFalseStart1) != 0) bFalseStart = TRUE; else { if (PrfQueryProfileString(HINI_USERPROFILE,szConfigDDname,"Initialization",0L, pszPath, stInst.ulMaxPathLen) != 0) { strcpy(stInst.pszAppsPath,pszPath); SetEndOfPath(stInst.pszAppsPath); sprintf(pszUninstallIniPath,"%s\\%s",stInst.pszAppsPath,szUninstallIniFileName); bPreviousInstallation = TRUE; } else { strcpy(stInst.pszAppsPath,szDefaultAppsPath); stInst.pszAppsPath[0] = stInst.chBootDrive; sprintf(pszUninstallIniPath,"%s\\%s",stInst.pszAppsPath,szUninstallIniFileName); strcpy(stInst.pszDLLpath,szDefaultDLLpath); stInst.pszDLLpath[0] = stInst.chBootDrive; sprintf(pszPath,"%s\\%s",stInst.pszAppsPath,szDDname); } // strcpy(stInst.paszStrings[CURRENTDRIVERSPEC],pszPath); strcpy(stInst.paszStrings[DRIVERINISPEC],pszPath); AppendINI(stInst.paszStrings[DRIVERINISPEC]); } } strcpy(stCOMiCFG.pszDriverIniSpec,stInst.paszStrings[DRIVERINISPEC]); if (strlen(pszUninstallIniPath) != 0) { if (DosQueryPathInfo(pszUninstallIniPath,1,&stFileStatus,sizeof(FILESTATUS3)) == NO_ERROR) { if ((hInstalledProfile = PrfOpenProfile(stInst.hab,pszUninstallIniPath)) != 0) { if (PrfQueryProfileString(hInstalledProfile,"Installed","Program Path",0,pszPath,stInst.ulMaxPathLen)) { strcpy(pszCurrentAppsPath,pszPath); bUninstall = TRUE; } if (PrfQueryProfileString(hInstalledProfile,"Installed","Library Path",0,pszPath,stInst.ulMaxPathLen)) strcpy(stInst.pszDLLpath,pszPath); else strcpy(stInst.pszDLLpath,stInst.pszAppsPath); PrfCloseProfile(hInstalledProfile); } } } stInst.cbSize = sizeof(INSTALL); sprintf(stInst.paszStrings[CONFIGDDLIBRARYSPEC],"%s\\%s.DLL",stInst.pszSourcePath,szConfigDDlibraryName); stCOMiCFG.byOEMtype = (BYTE)ulOEMtype; flCreate = (FCF_BORDER | FCF_ACCELTABLE | FCF_TASKLIST | FCF_MENU | FCF_TITLEBAR | FCF_SYSMENU); stInst.hwndFrame = WinCreateStdWindow(HWND_DESKTOP, 0L, &flCreate, "INSTALL", NULL, WS_CLIPCHILDREN, (HMODULE)NULL, WIN_INSTALL, &hwndClient); WinSetWindowText(stInst.hwndFrame,szEXEtitle); SetInitialPosition(stInst.hwndFrame); WinShowWindow(stInst.hwndFrame,TRUE); WinSetFocus(HWND_DESKTOP,hwndClient); if (strlen(szConfigAppName) == 0) { WinSendMsg(WinWindowFromID(stInst.hwndFrame,FID_MENU),MM_REMOVEITEM,MPFROM2SHORT(IDM_CONFIG_APP,TRUE),(MPARAM)0); #ifdef this_junk bItemThreeLocked = TRUE; InsertAppMenu(); MenuItemEnable(stInst.hwndFrame,IDM_CONFIG_APP,FALSE); #endif } if ((hwndInstallHelpInstance = HelpInit(pszHelpFileSpec,szHelpWindowTitle)) == 0) { MenuItemEnable(stInst.hwndFrame,IDM_HELPINDEX,FALSE); MenuItemEnable(stInst.hwndFrame,IDM_HELPEXTEND,FALSE); MenuItemEnable(stInst.hwndFrame,IDM_HELPKEYS,FALSE); MenuItemEnable(stInst.hwndFrame,IDM_HELPFORHELP,FALSE); } while(WinGetMsg(stInst.hab,&qmsgMessage,(HWND)NULL,0,0)) WinDispatchMsg(stInst.hab,&qmsgMessage); DestroyHelpInstance(hwndInstallHelpInstance); if (hConfigProfile != 0) PrfCloseProfile(hConfigProfile); if (hSourceProfile != 0) PrfCloseProfile(hSourceProfile); MemFree(pszPath); MemFree(stInst.paszStrings[XFERLIBRARYSPEC]); MemFree(stInst.paszStrings[CONFIGDDLIBRARYSPEC]); MemFree(stCOMiCFG.pszRemoveOldDriverSpec); MemFree(stInst.pszSourceIniPath); if (stInst.paszStrings[REMOVEOLDDRIVERSPEC] != NULL) MemFree(stInst.paszStrings[REMOVEOLDDRIVERSPEC]); MemFree(stInst.paszStrings[CURRENTDRIVERSPEC]); MemFree(stInst.paszStrings[DRIVERINISPEC]); MemFree(stInst.pszDLLpath); MemFree(stInst.pszAppsPath); MemFree(pszUninstallIniPath); MemFree(pszCurrentAppsPath); MemFree(stInst.pszSourcePath); MemFree(pszHelpFileSpec); MemFree(stCOMiCFG.pszDriverIniSpec); WinDestroyWindow(stInst.hwndFrame); WinDestroyMsgQueue(hmqQueue); WinTerminate(stInst.hab); exit(0); }