mirror of
https://github.com/reactos/reactos.git
synced 2024-10-01 15:07:53 +00:00
Revert r25952 for now.
svn path=/trunk/; revision=26807
This commit is contained in:
parent
8559c5a684
commit
be864d9d6e
|
@ -221,11 +221,31 @@ ThreadFunc(LPVOID Context)
|
||||||
{
|
{
|
||||||
//static const WCHAR szUrl[] = DownloadUrl;
|
//static const WCHAR szUrl[] = DownloadUrl;
|
||||||
IBindStatusCallback *dl;
|
IBindStatusCallback *dl;
|
||||||
HWND Dlg = ((struct lParamDownload*)Context)->Dlg;
|
WCHAR path[MAX_PATH];
|
||||||
|
LPWSTR p;
|
||||||
|
STARTUPINFOW si;
|
||||||
|
PROCESS_INFORMATION pi;
|
||||||
|
HWND Dlg = (HWND) Context;
|
||||||
DWORD r;
|
DWORD r;
|
||||||
BOOL bCancelled = FALSE;
|
BOOL bCancelled = FALSE;
|
||||||
dl = CreateDl(Dlg, &bCancelled);
|
BOOL bTempfile = FALSE;
|
||||||
r = URLDownloadToFileW(NULL, ((struct lParamDownload*)Context)->URL, ((struct lParamDownload*)Context)->File, 0, dl);
|
|
||||||
|
/* built the path for the download */
|
||||||
|
p = wcsrchr(SelectedApplication->Location, L'/');
|
||||||
|
if (NULL == p)
|
||||||
|
{
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
if (! GetTempPathW(MAX_PATH, path))
|
||||||
|
{
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
wcscat(path, p + 1);
|
||||||
|
|
||||||
|
/* download it */
|
||||||
|
bTempfile = TRUE;
|
||||||
|
dl = CreateDl(Context, &bCancelled);
|
||||||
|
r = URLDownloadToFileW(NULL, SelectedApplication->Location, path, 0, dl);
|
||||||
if (NULL != dl)
|
if (NULL != dl)
|
||||||
{
|
{
|
||||||
IBindStatusCallback_Release(dl);
|
IBindStatusCallback_Release(dl);
|
||||||
|
@ -233,6 +253,30 @@ ThreadFunc(LPVOID Context)
|
||||||
if (S_OK != r)
|
if (S_OK != r)
|
||||||
{
|
{
|
||||||
MessageBoxW(0,Strings[IDS_DOWNLOAD_ERROR],0,0);
|
MessageBoxW(0,Strings[IDS_DOWNLOAD_ERROR],0,0);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
else if (bCancelled)
|
||||||
|
{
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
ShowWindow(Dlg, SW_HIDE);
|
||||||
|
|
||||||
|
/* run it */
|
||||||
|
memset(&si, 0, sizeof(si));
|
||||||
|
si.cb = sizeof(si);
|
||||||
|
r = CreateProcessW(path, NULL, NULL, NULL, 0, 0, NULL, NULL, &si, &pi);
|
||||||
|
if (0 == r)
|
||||||
|
{
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
CloseHandle(pi.hThread);
|
||||||
|
WaitForSingleObject(pi.hProcess, INFINITE);
|
||||||
|
CloseHandle(pi.hProcess);
|
||||||
|
|
||||||
|
end:
|
||||||
|
if (bTempfile)
|
||||||
|
{
|
||||||
|
DeleteFileW(path);
|
||||||
}
|
}
|
||||||
EndDialog(Dlg, 0);
|
EndDialog(Dlg, 0);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -243,7 +287,7 @@ DownloadProc(HWND Dlg, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
HANDLE Thread;
|
HANDLE Thread;
|
||||||
DWORD ThreadId;
|
DWORD ThreadId;
|
||||||
HWND Item;;
|
HWND Item;
|
||||||
|
|
||||||
switch (Msg)
|
switch (Msg)
|
||||||
{
|
{
|
||||||
|
@ -276,8 +320,7 @@ DownloadProc(HWND Dlg, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||||
ShowWindow(Item, SW_HIDE);
|
ShowWindow(Item, SW_HIDE);
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
((struct lParamDownload*)lParam)->Dlg = Dlg;
|
Thread = CreateThread(NULL, 0, ThreadFunc, Dlg, 0, &ThreadId);
|
||||||
Thread = CreateThread(NULL, 0, ThreadFunc, (LPVOID)lParam, 0, &ThreadId);
|
|
||||||
if (NULL == Thread)
|
if (NULL == Thread)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
|
<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
|
||||||
<directory name="packagetree">
|
<installfile base="system32">downloader.xml</installfile>
|
||||||
<xi:include href="packagetree/packagetree.rbuild" />
|
|
||||||
</directory>
|
|
||||||
<module name="downloader" type="win32gui" installbase="system32" installname="downloader.exe">
|
<module name="downloader" type="win32gui" installbase="system32" installname="downloader.exe">
|
||||||
<include base="downloader">.</include>
|
<include base="downloader">.</include>
|
||||||
<include base="expat">.</include>
|
<include base="expat">.</include>
|
||||||
|
@ -29,6 +27,5 @@
|
||||||
<file>main.c</file>
|
<file>main.c</file>
|
||||||
<file>xml.c</file>
|
<file>xml.c</file>
|
||||||
<file>download.c</file>
|
<file>download.c</file>
|
||||||
<file>script.c</file>
|
|
||||||
<file>downloader.rc</file>
|
<file>downloader.rc</file>
|
||||||
</module>
|
</module>
|
||||||
|
|
|
@ -1,5 +1,61 @@
|
||||||
<tree Version="1"> <!-- Application version this tree is made for -->
|
<tree Version="1"> <!-- Application version this tree is made for -->
|
||||||
<import file="internet\category.xml" />
|
<category name="Internet & Network" icon="1">
|
||||||
|
<application name="Firefox 1.5">
|
||||||
|
<regname>Mozilla Firefox (1.5)</regname>
|
||||||
|
<licence>MPL/GPL/LGPL</licence>
|
||||||
|
<version>1.5.0.9</version>
|
||||||
|
<description>The most popular and one of the best free WebBrowsers out there.</description>
|
||||||
|
<location>http://ftp-mozilla.netscape.com/pub/mozilla.org/firefox/releases/1.5.0.9/win32/en-US/Firefox%20Setup%201.5.0.9.exe</location>
|
||||||
|
</application>
|
||||||
|
<application name="Firefox 2.0">
|
||||||
|
<regname>Mozilla Firefox (2.0.0.1)</regname>
|
||||||
|
<licence>MPL/GPL/LGPL</licence>
|
||||||
|
<version>2.0.0.1</version>
|
||||||
|
<description>The most popular and one of the best free WebBrowsers out there.</description>
|
||||||
|
<location>http://ftp-mozilla.netscape.com/pub/mozilla.org/firefox/releases/latest/win32/en-US/Firefox%20Setup%202.0.0.1.exe</location>
|
||||||
|
</application>
|
||||||
|
<application name="Thunderbird">
|
||||||
|
<regname>Mozilla Thunderbird (1.5)</regname>
|
||||||
|
<licence>MPL/GPL/LGPL</licence>
|
||||||
|
<version>1.5.0.9</version>
|
||||||
|
<description>The most popular and one of the best free MailClients out there.</description>
|
||||||
|
<location>http://ftp-mozilla.netscape.com/pub/mozilla.org/thunderbird/releases/latest/win32/en-US/Thunderbird%20Setup%201.5.0.9.exe</location>
|
||||||
|
</application>
|
||||||
|
<application name="SeaMonkey">
|
||||||
|
<regname>SeaMonkey (1.0.7)</regname>
|
||||||
|
<version>1.0.7</version>
|
||||||
|
<description>Mozilla Suite is alive. This is the one and only Browser, Mail, Chat, Composer bundle you will ever need.</description>
|
||||||
|
<location>http://ftp-mozilla.netscape.com/pub/mozilla.org/seamonkey/releases/1.0.7/seamonkey-1.0.7.en-US.win32.installer.exe</location>
|
||||||
|
</application>
|
||||||
|
<application name="Mozilla ActiveX Control">
|
||||||
|
<regname>Mozilla ActiveX Control v1.7.12 (ReactOS special)</regname>
|
||||||
|
<version>1.7.12</version>
|
||||||
|
<description>Essential Component to get ReactOS Explorer's and other application's Internet Browsing feature running.</description>
|
||||||
|
<location>http://ovh.dl.sourceforge.net/sourceforge/reactos/MozillaControl1712-ReactOS.exe</location>
|
||||||
|
</application>
|
||||||
|
<application name="Off By One Browser">
|
||||||
|
<regname>The Off By One Web Browser</regname>
|
||||||
|
<description>The Off By One Browser is a very small and fast web browser with full HTML 3.2 support.</description>
|
||||||
|
<location>http://offbyone.com/offbyone/images/OffByOneSetup.exe</location>
|
||||||
|
</application>
|
||||||
|
<application name="Samba TNG">
|
||||||
|
<description>This tool allows you to access your Windows shared folders/printers with ReactOS.</description>
|
||||||
|
<location>http://svn.reactos.org/packages/samba-tng.exe</location>
|
||||||
|
</application>
|
||||||
|
<application name="Miranda IM">
|
||||||
|
<regname>Miranda IM</regname>
|
||||||
|
<version>0.5.1</version>
|
||||||
|
<description>Open source multiprotocol instant messaging application - May not work completely.</description>
|
||||||
|
<location>http://ovh.dl.sourceforge.net/sourceforge/miranda/miranda-im-v0.5.1-unicode.exe</location>
|
||||||
|
</application>
|
||||||
|
<application name="Putty">
|
||||||
|
<regname>PuTTY version 0.59</regname>
|
||||||
|
<licence>MIT</licence>
|
||||||
|
<version>0.59</version>
|
||||||
|
<description>A free SSH, Telnet, rlogin, and raw TCP client.</description>
|
||||||
|
<location>http://the.earth.li/~sgtatham/putty/latest/x86/putty-0.59-installer.exe</location>
|
||||||
|
</application>
|
||||||
|
</category>
|
||||||
<category name="Office" icon="2">
|
<category name="Office" icon="2">
|
||||||
<application name="Abiword">
|
<application name="Abiword">
|
||||||
<regname>"AbiWord 2.4.1 (remove only)"</regname>
|
<regname>"AbiWord 2.4.1 (remove only)"</regname>
|
||||||
|
@ -99,7 +155,7 @@
|
||||||
<location>http://ovh.dl.sourceforge.net/sourceforge/sevenzip/7z442.exe</location>
|
<location>http://ovh.dl.sourceforge.net/sourceforge/sevenzip/7z442.exe</location>
|
||||||
</application>
|
</application>
|
||||||
<application name="uTorrent">
|
<application name="uTorrent">
|
||||||
<regname>uTorrent</regname>
|
<regname>µTorrent</regname>
|
||||||
<version>1.6</version>
|
<version>1.6</version>
|
||||||
<description>Small and fast Torrent Client.</description>
|
<description>Small and fast Torrent Client.</description>
|
||||||
<location>http://download.utorrent.com/1.6/uTorrent-1.6-install.exe</location>
|
<location>http://download.utorrent.com/1.6/uTorrent-1.6-install.exe</location>
|
||||||
|
@ -113,25 +169,9 @@
|
||||||
</category>
|
</category>
|
||||||
<category name="Others" icon="8">
|
<category name="Others" icon="8">
|
||||||
<application name="Simple Direct Media Layer (SDL) Runtime">
|
<application name="Simple Direct Media Layer (SDL) Runtime">
|
||||||
<regname>SDL Runtime</regname>
|
|
||||||
<version>1.2.11</version>
|
<version>1.2.11</version>
|
||||||
<description>Needed for many Open Source Games to run. You need 7-Zip or a similar Utility to extract it.</description>
|
<description>Needed for many Open Source Games to run. You need 7-Zip or a similar Utility to extract it.</description>
|
||||||
<location>http://ovh.dl.sourceforge.net/sourceforge/libsdl/SDL-1.2.11-win32.zip</location>
|
<location>http://ovh.dl.sourceforge.net/sourceforge/libsdl/SDL-1.2.11-win32.zip</location>
|
||||||
<installscript>
|
|
||||||
<load file="test.xml" />
|
|
||||||
<unzip />
|
|
||||||
<download url="%location%" file="%TEMP%\%location_file%" />
|
|
||||||
<unzip file="%TEMP%\%location_file%" outdir="%SystemRoot%\System32" />
|
|
||||||
<exec file="notepad %SystemRoot%\System32\README-SDL.txt" />
|
|
||||||
<del file="%TEMP%\%location_file%" />
|
|
||||||
<adduninstaller regname="%regname%" file="downloader.exe show %name%" />
|
|
||||||
</installscript>
|
|
||||||
<uninstallscript>
|
|
||||||
<del file="%SystemRoot%\System32\SDL.dll" />
|
|
||||||
<del file="%SystemRoot%\System32\README-SDL.txt" />
|
|
||||||
<removeuninstaller regname="%regname%" />
|
|
||||||
<message text="Uninstall complete." />
|
|
||||||
</uninstallscript>
|
|
||||||
</application>
|
</application>
|
||||||
<application name="DOSBox">
|
<application name="DOSBox">
|
||||||
<version>0.65</version>
|
<version>0.65</version>
|
|
@ -10,65 +10,46 @@
|
||||||
#include <richedit.h>
|
#include <richedit.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <shlwapi.h>
|
#include <shlwapi.h>
|
||||||
#include <wchar.h>
|
|
||||||
#include "resources.h"
|
#include "resources.h"
|
||||||
#include "structures.h"
|
#include "structures.h"
|
||||||
|
|
||||||
#define XML_PATH "tree.xml"
|
#define XML_PATH "C:\\ReactOS\\system32\\downloader.xml"
|
||||||
|
|
||||||
HWND hwnd, hCategories, hApps, hDownloadButton, hUninstallButton, hUpdateButton, hHelpButton;
|
HWND hwnd, hCategories, hApps, hDownloadButton, hUninstallButton, hUpdateButton, hHelpButton;
|
||||||
HBITMAP hLogo, hUnderline;
|
HBITMAP hLogo, hUnderline;
|
||||||
CHAR* CmdLine;
|
|
||||||
WCHAR* DescriptionHeadline = L"";
|
WCHAR* DescriptionHeadline = L"";
|
||||||
WCHAR* DescriptionText = L"";
|
WCHAR* DescriptionText = L"";
|
||||||
WCHAR ApplicationText[0xA04]; // MAX_STRING_LENGHT + Version + \n + MAX_STRING_LENGHT + Licence + \n + MAX_STRING_LENGHT + Maintainer + \n\n + Description
|
WCHAR ApplicationText[700];
|
||||||
// 0x100 + 0x100 + 1 + 0x100 + 0x100 + 1 + 0x100 + 0x100 + 2 + 0x400 = 0xA04
|
|
||||||
struct Category Root;
|
struct Category Root;
|
||||||
struct Application* SelectedApplication;
|
struct Application* SelectedApplication;
|
||||||
|
|
||||||
INT_PTR CALLBACK DownloadProc (HWND, UINT, WPARAM, LPARAM);
|
INT_PTR CALLBACK DownloadProc (HWND, UINT, WPARAM, LPARAM);
|
||||||
DWORD WINAPI InstallThreadFunc(LPVOID);
|
|
||||||
DWORD WINAPI UninstallThreadFunc(LPVOID);
|
|
||||||
BOOL ProcessXML (const char* filename, struct Category* Root);
|
BOOL ProcessXML (const char* filename, struct Category* Root);
|
||||||
char* addDML (const char*);
|
|
||||||
VOID FreeTree (struct Category* Node);
|
VOID FreeTree (struct Category* Node);
|
||||||
WCHAR Strings [STRING_COUNT][MAX_STRING_LENGHT];
|
WCHAR Strings [STRING_COUNT][MAX_STRING_LENGHT];
|
||||||
|
|
||||||
BOOL getUninstaller(struct Application* CurrentApplication, WCHAR* Uninstaller) {
|
|
||||||
|
|
||||||
DWORD ArraySize = 0x100;
|
BOOL getUninstaller(WCHAR* RegName, WCHAR* Uninstaller) {
|
||||||
|
|
||||||
|
const DWORD ArraySize = 200;
|
||||||
|
|
||||||
HKEY hKey1;
|
HKEY hKey1;
|
||||||
HKEY hKey2;
|
HKEY hKey2;
|
||||||
DWORD Type = 0;
|
DWORD Type = 0;
|
||||||
|
DWORD Size = ArraySize;
|
||||||
WCHAR Value[ArraySize];
|
WCHAR Value[ArraySize];
|
||||||
WCHAR KeyName[ArraySize];
|
WCHAR KeyName[ArraySize];
|
||||||
DWORD Size = ArraySize;
|
|
||||||
LONG i = 0;
|
LONG i = 0;
|
||||||
|
|
||||||
if (CurrentApplication->RegName[0] == L'\0') {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",0,KEY_READ,&hKey1) == ERROR_SUCCESS) {
|
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",0,KEY_READ,&hKey1) == ERROR_SUCCESS) {
|
||||||
if (RegOpenKeyExW(hKey1,CurrentApplication->RegName,0,KEY_READ,&hKey2) == ERROR_SUCCESS) {
|
|
||||||
if (RegQueryValueExW(hKey2,L"UninstallString",0,&Type,(LPBYTE)Uninstaller,&Size) == ERROR_SUCCESS) {
|
|
||||||
RegCloseKey(hKey2);
|
|
||||||
RegCloseKey(hKey1);
|
|
||||||
return TRUE;
|
|
||||||
} else {
|
|
||||||
RegCloseKey(hKey2);
|
|
||||||
RegCloseKey(hKey1);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (RegEnumKeyExW(hKey1,i,KeyName,&Size,NULL,NULL,NULL,NULL) == ERROR_SUCCESS) {
|
while (RegEnumKeyExW(hKey1,i,KeyName,&Size,NULL,NULL,NULL,NULL) == ERROR_SUCCESS) {
|
||||||
++i;
|
++i;
|
||||||
RegOpenKeyExW(hKey1,KeyName,0,KEY_READ,&hKey2);
|
RegOpenKeyExW(hKey1,KeyName,0,KEY_READ,&hKey2);
|
||||||
Size = sizeof(Value);
|
Size = ArraySize;
|
||||||
if (RegQueryValueExW(hKey2,L"DisplayName",0,&Type,(LPBYTE)Value,&Size) == ERROR_SUCCESS) {
|
if (RegQueryValueExW(hKey2,L"DisplayName",0,&Type,(LPBYTE)Value,&Size) == ERROR_SUCCESS) {
|
||||||
Size = ArraySize;
|
Size = ArraySize;
|
||||||
if (!wcscmp(Value,CurrentApplication->RegName)) {
|
if (StrCmpW(Value,RegName) == 0) {
|
||||||
if (RegQueryValueExW(hKey2,L"UninstallString",0,&Type,(LPBYTE)Uninstaller,&Size) == ERROR_SUCCESS) {
|
if (RegQueryValueExW(hKey2,L"UninstallString",0,&Type,(LPBYTE)Uninstaller,&Size) == ERROR_SUCCESS) {
|
||||||
RegCloseKey(hKey2);
|
RegCloseKey(hKey2);
|
||||||
RegCloseKey(hKey1);
|
RegCloseKey(hKey1);
|
||||||
|
@ -142,15 +123,16 @@ void CategoryChoosen (HWND hwnd, struct Category* Category)
|
||||||
|
|
||||||
CurrentApplication = Category->Apps;
|
CurrentApplication = Category->Apps;
|
||||||
|
|
||||||
|
WCHAR Uninstaller[200];
|
||||||
while(CurrentApplication)
|
while(CurrentApplication)
|
||||||
{
|
{
|
||||||
Insert.item.lParam = (UINT)CurrentApplication;
|
Insert.item.lParam = (UINT)CurrentApplication;
|
||||||
Insert.item.pszText = CurrentApplication->Name;
|
Insert.item.pszText = CurrentApplication->Name;
|
||||||
Insert.item.cchTextMax = lstrlenW(CurrentApplication->Name);
|
Insert.item.cchTextMax = lstrlenW(CurrentApplication->Name);
|
||||||
if(getUninstaller(CurrentApplication, NULL)) {
|
Insert.item.iImage = 10;
|
||||||
Insert.item.iImage = 9;
|
if(StrCmpW(CurrentApplication->RegName,L"")) {
|
||||||
} else {
|
if(getUninstaller(CurrentApplication->RegName, Uninstaller))
|
||||||
Insert.item.iImage = 10;
|
Insert.item.iImage = 9;
|
||||||
}
|
}
|
||||||
SendMessage(hwnd, TVM_INSERTITEM, 0, (LPARAM)&Insert);
|
SendMessage(hwnd, TVM_INSERTITEM, 0, (LPARAM)&Insert);
|
||||||
CurrentApplication = CurrentApplication->Next;
|
CurrentApplication = CurrentApplication->Next;
|
||||||
|
@ -179,8 +161,8 @@ BOOL SetupControls (HWND hwnd)
|
||||||
|
|
||||||
hHelpButton = CreateWindowW (L"Button", L"", WS_CHILD|WS_VISIBLE|BS_BITMAP, 550, 10, 40, 40, hwnd, 0, hInstance, NULL);
|
hHelpButton = CreateWindowW (L"Button", L"", WS_CHILD|WS_VISIBLE|BS_BITMAP, 550, 10, 40, 40, hwnd, 0, hInstance, NULL);
|
||||||
hUpdateButton = CreateWindowW (L"Button", L"", WS_CHILD|WS_VISIBLE|BS_BITMAP, 500, 10, 40, 40, hwnd, 0, hInstance, NULL);
|
hUpdateButton = CreateWindowW (L"Button", L"", WS_CHILD|WS_VISIBLE|BS_BITMAP, 500, 10, 40, 40, hwnd, 0, hInstance, NULL);
|
||||||
hDownloadButton = CreateWindowW (L"Button", L"", WS_CHILD|WS_VISIBLE|BS_BITMAP, 330, 505, 140, 35, hwnd, 0, hInstance, NULL);
|
hDownloadButton = CreateWindowW (L"Button", L"", WS_CHILD|WS_VISIBLE|BS_BITMAP, 330, 505, 140, 33, hwnd, 0, hInstance, NULL);
|
||||||
hUninstallButton = CreateWindowW (L"Button", L"", WS_CHILD|WS_VISIBLE|BS_BITMAP, 260, 505, 140, 35, hwnd, 0, hInstance, NULL);
|
hUninstallButton = CreateWindowW (L"Button", L"", WS_CHILD|WS_VISIBLE|BS_BITMAP, 260, 505, 140, 33, hwnd, 0, hInstance, NULL);
|
||||||
|
|
||||||
SendMessageW(hHelpButton, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)(HANDLE)LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_HELP)));
|
SendMessageW(hHelpButton, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)(HANDLE)LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_HELP)));
|
||||||
SendMessageW(hUpdateButton, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,(LPARAM)(HANDLE)LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_UPDATE)));
|
SendMessageW(hUpdateButton, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,(LPARAM)(HANDLE)LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_UPDATE)));
|
||||||
|
@ -285,41 +267,17 @@ void hideUninstaller() {
|
||||||
MoveWindow(hDownloadButton,(Split_Vertical+Rect.right-Rect.left)/2-70,Rect.bottom-Rect.top-45,140,35,TRUE);
|
MoveWindow(hDownloadButton,(Split_Vertical+Rect.right-Rect.left)/2-70,Rect.bottom-Rect.top-45,140,35,TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void searchApp(const WCHAR* AppName, struct Category* Node) {
|
void startUninstaller(WCHAR* Uninstaller) {
|
||||||
struct Application* CurrentApplication;
|
STARTUPINFOW si;
|
||||||
if (Node->Children)
|
PROCESS_INFORMATION pi;
|
||||||
searchApp(AppName, Node->Children);
|
|
||||||
if (Node->Next)
|
|
||||||
searchApp(AppName, Node->Next);
|
|
||||||
CurrentApplication = Node->Apps;
|
|
||||||
while((SelectedApplication == NULL) && (CurrentApplication != NULL)) {
|
|
||||||
if(wcscmp(CurrentApplication->Name,AppName)==0)
|
|
||||||
SelectedApplication = CurrentApplication;
|
|
||||||
CurrentApplication = CurrentApplication->Next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ShowSelectedApplication() {
|
memset(&si, 0, sizeof(si));
|
||||||
ApplicationText[0]=L'\0';
|
si.cb = sizeof(si);
|
||||||
if(SelectedApplication->Version[0] != L'\0') {
|
CreateProcessW(NULL,Uninstaller,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
|
||||||
StrCatW(ApplicationText, Strings[IDS_VERSION]);
|
CloseHandle(pi.hThread);
|
||||||
StrCatW(ApplicationText, SelectedApplication->Version);
|
// WaitForSingleObject(pi.hProcess, INFINITE); // If you want to wait for the Unistaller
|
||||||
StrCatW(ApplicationText, L"\n");
|
CloseHandle(pi.hProcess);
|
||||||
}
|
hideUninstaller();
|
||||||
if(SelectedApplication->Licence[0] != L'\0') {
|
|
||||||
StrCatW(ApplicationText, Strings[IDS_LICENCE]);
|
|
||||||
StrCatW(ApplicationText, SelectedApplication->Licence);
|
|
||||||
StrCatW(ApplicationText, L"\n");
|
|
||||||
}
|
|
||||||
if(SelectedApplication->Maintainer[0] != L'\0') {
|
|
||||||
StrCatW(ApplicationText, Strings[IDS_MAINTAINER]);
|
|
||||||
StrCatW(ApplicationText, SelectedApplication->Maintainer);
|
|
||||||
StrCatW(ApplicationText, L"\n");
|
|
||||||
}
|
|
||||||
if((SelectedApplication->Licence[0] != L'\0') || (SelectedApplication->Version[0] != L'\0') || (SelectedApplication->Maintainer[0] != L'\0'))
|
|
||||||
StrCatW(ApplicationText, L"\n");
|
|
||||||
StrCatW(ApplicationText, SelectedApplication->Description);
|
|
||||||
ShowMessage(SelectedApplication->Name, ApplicationText);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK WndProc (HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK WndProc (HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||||
|
@ -330,34 +288,9 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
{
|
{
|
||||||
WCHAR wAppName[0x100] = L"";
|
|
||||||
if (strncmp(CmdLine,"add ",4)==0) {
|
|
||||||
CmdLine = CmdLine+4;
|
|
||||||
if(CmdLine[0]==L'\"') {
|
|
||||||
CmdLine++;
|
|
||||||
CmdLine[strlen(CmdLine)-1]=L'\0';
|
|
||||||
}
|
|
||||||
char* aAppName = addDML(CmdLine);
|
|
||||||
MultiByteToWideChar(CP_UTF8, 0, aAppName, -1, wAppName, 0x100);
|
|
||||||
} else if (strncmp(CmdLine,"show ",5)==0) {
|
|
||||||
MultiByteToWideChar(CP_UTF8, 0, CmdLine+5, -1, wAppName, 0x100);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!SetupControls(hwnd))
|
if(!SetupControls(hwnd))
|
||||||
return -1;
|
return -1;
|
||||||
|
ShowMessage(Strings[IDS_WELCOME_TITLE], Strings[IDS_WELCOME]);
|
||||||
if(wAppName[0]!=L'\0')
|
|
||||||
searchApp(wAppName, &Root);
|
|
||||||
|
|
||||||
if(SelectedApplication == NULL) {
|
|
||||||
ShowMessage(Strings[IDS_WELCOME_TITLE], Strings[IDS_WELCOME]);
|
|
||||||
} else {
|
|
||||||
ShowSelectedApplication();
|
|
||||||
if(getUninstaller(SelectedApplication, NULL))
|
|
||||||
showUninstaller();
|
|
||||||
else
|
|
||||||
hideUninstaller();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -386,20 +319,21 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
if (lParam == (LPARAM)hDownloadButton)
|
if (lParam == (LPARAM)hDownloadButton)
|
||||||
{
|
{
|
||||||
if(SelectedApplication) {
|
if(SelectedApplication)
|
||||||
DWORD ThreadId;
|
DialogBoxW(GetModuleHandle(NULL), MAKEINTRESOURCEW(IDD_DOWNLOAD), 0, DownloadProc);
|
||||||
CreateThread(NULL, 0, InstallThreadFunc, SelectedApplication, 0, &ThreadId);
|
else
|
||||||
} else
|
|
||||||
ShowMessage(Strings[IDS_NO_APP_TITLE], Strings[IDS_NO_APP]);
|
ShowMessage(Strings[IDS_NO_APP_TITLE], Strings[IDS_NO_APP]);
|
||||||
}
|
}
|
||||||
else if (lParam == (LPARAM)hUninstallButton)
|
else if (lParam == (LPARAM)hUninstallButton)
|
||||||
{
|
{
|
||||||
if(SelectedApplication) {
|
if(SelectedApplication)
|
||||||
DWORD ThreadId;
|
{
|
||||||
CreateThread(NULL, 0, UninstallThreadFunc, SelectedApplication, 0, &ThreadId);
|
WCHAR Uninstaller[200];
|
||||||
hideUninstaller();
|
if(StrCmpW(SelectedApplication->RegName, L"")) {
|
||||||
} else
|
if(getUninstaller(SelectedApplication->RegName, Uninstaller))
|
||||||
ShowMessage(Strings[IDS_NO_APP_TITLE], Strings[IDS_NO_APP]);
|
startUninstaller(Uninstaller);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (lParam == (LPARAM)hUpdateButton)
|
else if (lParam == (LPARAM)hUpdateButton)
|
||||||
{
|
{
|
||||||
|
@ -429,9 +363,31 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||||
SelectedApplication = (struct Application*) ((LPNMTREEVIEW)lParam)->itemNew.lParam;
|
SelectedApplication = (struct Application*) ((LPNMTREEVIEW)lParam)->itemNew.lParam;
|
||||||
if(SelectedApplication)
|
if(SelectedApplication)
|
||||||
{
|
{
|
||||||
ShowSelectedApplication();
|
ApplicationText[0]=L'\0';
|
||||||
if(getUninstaller(SelectedApplication, NULL)) {
|
if(StrCmpW(SelectedApplication->Version, L"")) {
|
||||||
bShowUninstaller = TRUE;
|
StrCatW(ApplicationText, Strings[IDS_VERSION]);
|
||||||
|
StrCatW(ApplicationText, SelectedApplication->Version);
|
||||||
|
StrCatW(ApplicationText, L"\n");
|
||||||
|
}
|
||||||
|
if(StrCmpW(SelectedApplication->Licence, L"")) {
|
||||||
|
StrCatW(ApplicationText, Strings[IDS_LICENCE]);
|
||||||
|
StrCatW(ApplicationText, SelectedApplication->Licence);
|
||||||
|
StrCatW(ApplicationText, L"\n");
|
||||||
|
}
|
||||||
|
if(StrCmpW(SelectedApplication->Maintainer, L"")) {
|
||||||
|
StrCatW(ApplicationText, Strings[IDS_MAINTAINER]);
|
||||||
|
StrCatW(ApplicationText, SelectedApplication->Maintainer);
|
||||||
|
StrCatW(ApplicationText, L"\n");
|
||||||
|
}
|
||||||
|
if(StrCmpW(SelectedApplication->Licence, L"") || StrCmpW(SelectedApplication->Version, L"") || StrCmpW(SelectedApplication->Maintainer, L""))
|
||||||
|
StrCatW(ApplicationText, L"\n");
|
||||||
|
StrCatW(ApplicationText, SelectedApplication->Description);
|
||||||
|
ShowMessage(SelectedApplication->Name, ApplicationText);
|
||||||
|
WCHAR Uninstaller[200];
|
||||||
|
if(StrCmpW(SelectedApplication->RegName, L"")) {
|
||||||
|
if(getUninstaller(SelectedApplication->RegName, Uninstaller)) {
|
||||||
|
bShowUninstaller = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -496,7 +452,6 @@ INT WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInst,
|
||||||
MSG msg;
|
MSG msg;
|
||||||
|
|
||||||
InitCommonControls();
|
InitCommonControls();
|
||||||
CmdLine = lpCmdLine;
|
|
||||||
|
|
||||||
// Load strings
|
// Load strings
|
||||||
for(i=0; i<STRING_COUNT; i++)
|
for(i=0; i<STRING_COUNT; i++)
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
|
|
||||||
<installfile base="packagetree/internet/browser">firefox1509.dml</installfile>
|
|
||||||
<installfile base="packagetree/internet/browser">firefox2001.dml</installfile>
|
|
|
@ -1,7 +0,0 @@
|
||||||
<application name="Firefox 1.5" target="internet\browser\firefox.1.5.0.9.dml">
|
|
||||||
<regname>Mozilla Firefox (1.5)</regname>
|
|
||||||
<licence>MPL/GPL/LGPL</licence>
|
|
||||||
<version>1.5.0.9</version>
|
|
||||||
<description>The most popular and one of the best free WebBrowsers out there.</description>
|
|
||||||
<location>http://ftp-mozilla.netscape.com/pub/mozilla.org/firefox/releases/1.5.0.9/win32/en-US/Firefox%20Setup%201.5.0.9.exe</location>
|
|
||||||
</application>
|
|
|
@ -1,7 +0,0 @@
|
||||||
<application name="Firefox 2.0" target="internet\browser\firefox.2.0.0.1.dml">
|
|
||||||
<regname>Mozilla Firefox (2.0.0.1)</regname>
|
|
||||||
<licence>MPL/GPL/LGPL</licence>
|
|
||||||
<version>2.0.0.1</version>
|
|
||||||
<description>The most popular and one of the best free WebBrowsers out there.</description>
|
|
||||||
<location>http://ftp-mozilla.netscape.com/pub/mozilla.org/firefox/releases/latest/win32/en-US/Firefox%20Setup%202.0.0.1.exe</location>
|
|
||||||
</application>
|
|
|
@ -1,54 +0,0 @@
|
||||||
<category name="Internet & Network" icon="1">
|
|
||||||
<import folder="internet\browser" />
|
|
||||||
<import folder="internet\email" />
|
|
||||||
<import folder="internet\ftp" />
|
|
||||||
<import folder="internet\chat" />
|
|
||||||
<import folder="internet\filesharing" />
|
|
||||||
<import folder="internet\remotecontrol" />
|
|
||||||
<import folder="internet\server" />
|
|
||||||
<import folder="internet\monitoring" />
|
|
||||||
<import folder="internet\security" />
|
|
||||||
<import folder="internet\streaming" />
|
|
||||||
<import folder="internet\other" />
|
|
||||||
<application name="Thunderbird">
|
|
||||||
<regname>Mozilla Thunderbird (1.5)</regname>
|
|
||||||
<licence>MPL/GPL/LGPL</licence>
|
|
||||||
<version>1.5.0.9</version>
|
|
||||||
<description>The most popular and one of the best free MailClients out there.</description>
|
|
||||||
<location>http://ftp-mozilla.netscape.com/pub/mozilla.org/thunderbird/releases/latest/win32/en-US/Thunderbird%20Setup%201.5.0.9.exe</location>
|
|
||||||
</application>
|
|
||||||
<application name="SeaMonkey">
|
|
||||||
<regname>SeaMonkey (1.0.7)</regname>
|
|
||||||
<version>1.0.7</version>
|
|
||||||
<description>Mozilla Suite is alive. This is the one and only Browser, Mail, Chat, Composer bundle you will ever need.</description>
|
|
||||||
<location>http://ftp-mozilla.netscape.com/pub/mozilla.org/seamonkey/releases/1.0.7/seamonkey-1.0.7.en-US.win32.installer.exe</location>
|
|
||||||
</application>
|
|
||||||
<application name="Mozilla ActiveX Control">
|
|
||||||
<regname>Mozilla ActiveX Control v1.7.12 (ReactOS special)</regname>
|
|
||||||
<version>1.7.12</version>
|
|
||||||
<description>Essential Component to get ReactOS Explorer's and other application's Internet Browsing feature running.</description>
|
|
||||||
<location>http://ovh.dl.sourceforge.net/sourceforge/reactos/MozillaControl1712-ReactOS.exe</location>
|
|
||||||
</application>
|
|
||||||
<application name="Off By One Browser">
|
|
||||||
<regname>The Off By One Web Browser</regname>
|
|
||||||
<description>The Off By One Browser is a very small and fast web browser with full HTML 3.2 support.</description>
|
|
||||||
<location>http://offbyone.com/offbyone/images/OffByOneSetup.exe</location>
|
|
||||||
</application>
|
|
||||||
<application name="Samba TNG">
|
|
||||||
<description>This tool allows you to access your Windows shared folders/printers with ReactOS.</description>
|
|
||||||
<location>http://svn.reactos.org/packages/samba-tng.exe</location>
|
|
||||||
</application>
|
|
||||||
<application name="Miranda IM">
|
|
||||||
<regname>Miranda IM</regname>
|
|
||||||
<version>0.5.1</version>
|
|
||||||
<description>Open source multiprotocol instant messaging application - May not work completely.</description>
|
|
||||||
<location>http://ovh.dl.sourceforge.net/sourceforge/miranda/miranda-im-v0.5.1-unicode.exe</location>
|
|
||||||
</application>
|
|
||||||
<application name="Putty">
|
|
||||||
<regname>PuTTY version 0.59</regname>
|
|
||||||
<licence>MIT</licence>
|
|
||||||
<version>0.59</version>
|
|
||||||
<description>A free SSH, Telnet, rlogin, and raw TCP client.</description>
|
|
||||||
<location>http://the.earth.li/~sgtatham/putty/latest/x86/putty-0.59-installer.exe</location>
|
|
||||||
</application>
|
|
||||||
</category>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
|
|
||||||
<directory name="browser">
|
|
||||||
<xi:include href="browser/browser.rbuild" />
|
|
||||||
</directory>
|
|
||||||
<installfile base="packagetree/internet">category.xml</installfile>
|
|
|
@ -1,9 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
|
|
||||||
<directory name="internet">
|
|
||||||
<xi:include href="internet/internet.rbuild" />
|
|
||||||
</directory>
|
|
||||||
<directory name="script">
|
|
||||||
<xi:include href="script/script.rbuild" />
|
|
||||||
</directory>
|
|
||||||
<installfile base="packagetree">tree.xml</installfile>
|
|
|
@ -1,5 +0,0 @@
|
||||||
<script>
|
|
||||||
<download url="%location%" file="%TEMP%\%location_file%" />
|
|
||||||
<exec file="%TEMP%\%location_file%" />
|
|
||||||
<del file="%TEMP%\%location_file%" />
|
|
||||||
</script>
|
|
|
@ -1 +0,0 @@
|
||||||
<exec file="%regname_uninstaller%" />
|
|
|
@ -1,3 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<installfile base="packagetree/script">default_install.xml</installfile>
|
|
||||||
<installfile base="packagetree/script">default_uninstall.xml</installfile>
|
|
|
@ -39,10 +39,9 @@
|
||||||
#define IDS_XMLERROR_1 14
|
#define IDS_XMLERROR_1 14
|
||||||
#define IDS_XMLERROR_2 15
|
#define IDS_XMLERROR_2 15
|
||||||
#define IDS_DOWNLOAD_ERROR 16
|
#define IDS_DOWNLOAD_ERROR 16
|
||||||
#define IDS_UNZIP_ERROR 17
|
#define IDS_VERSION 17
|
||||||
#define IDS_VERSION 18
|
#define IDS_LICENCE 18
|
||||||
#define IDS_LICENCE 19
|
#define IDS_MAINTAINER 19
|
||||||
#define IDS_MAINTAINER 20
|
|
||||||
|
|
||||||
#define STRING_COUNT 21
|
#define STRING_COUNT 20
|
||||||
#define MAX_STRING_LENGHT 0x100
|
#define MAX_STRING_LENGHT 0x100
|
||||||
|
|
|
@ -1,246 +0,0 @@
|
||||||
/* PROJECT: ReactOS Downloader
|
|
||||||
* LICENSE: GPL - See COPYING in the top level directory
|
|
||||||
* FILE: base/applications/downloader/script.c
|
|
||||||
* PURPOSE: Run (un/)installscript
|
|
||||||
* PROGRAMMERS: Lester Kortenhoeven
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#include "resources.h"
|
|
||||||
#include "structures.h"
|
|
||||||
|
|
||||||
extern BOOL getUninstaller(struct Application*, WCHAR*);
|
|
||||||
extern INT_PTR CALLBACK DownloadProc (HWND, UINT, WPARAM, LPARAM);
|
|
||||||
extern WCHAR Strings [STRING_COUNT][MAX_STRING_LENGHT];
|
|
||||||
|
|
||||||
static void DownloadScriptFunc (WCHAR* URL, WCHAR* File) {
|
|
||||||
struct lParamDownload* lParam;
|
|
||||||
lParam = malloc(sizeof(struct lParamDownload));
|
|
||||||
lParam->URL = URL;
|
|
||||||
lParam->File = File;
|
|
||||||
DialogBoxParamW(GetModuleHandle(NULL), MAKEINTRESOURCEW(IDD_DOWNLOAD), 0, DownloadProc, (LPARAM)lParam);
|
|
||||||
free(lParam);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ExecScriptFunc(WCHAR* Arg) {
|
|
||||||
STARTUPINFOW si;
|
|
||||||
PROCESS_INFORMATION pi;
|
|
||||||
|
|
||||||
memset(&si, 0, sizeof(si));
|
|
||||||
si.cb=sizeof(si);
|
|
||||||
CreateProcessW(NULL,Arg,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
|
|
||||||
CloseHandle(pi.hThread);
|
|
||||||
WaitForSingleObject(pi.hProcess, INFINITE);
|
|
||||||
CloseHandle(pi.hProcess);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void DelScriptFunc(WCHAR* Arg) {
|
|
||||||
DeleteFileW(Arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
static BOOL UnzipScriptFunc(WCHAR* File, WCHAR* Outdir) {
|
|
||||||
HKEY hKey;
|
|
||||||
DWORD Type = 0;
|
|
||||||
WCHAR ExecStr[0x100];
|
|
||||||
DWORD currentlengt = 0x100;
|
|
||||||
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,L"SOFTWARE\\7-Zip",0,KEY_READ,&hKey) == ERROR_SUCCESS) {
|
|
||||||
if (RegQueryValueExW(hKey,L"Path",0,&Type,(LPBYTE)ExecStr,¤tlengt) == ERROR_SUCCESS) {
|
|
||||||
if (File[0] != L'\0') {
|
|
||||||
wcsncat(ExecStr,L"\\7z.exe x ",0x100-currentlengt);
|
|
||||||
currentlengt = lstrlenW(ExecStr);
|
|
||||||
wcsncat(ExecStr,File,0x100-currentlengt);
|
|
||||||
currentlengt = lstrlenW(ExecStr);
|
|
||||||
wcsncat(ExecStr,L" -o",0x100-currentlengt);
|
|
||||||
currentlengt = lstrlenW(ExecStr);
|
|
||||||
wcsncat(ExecStr,Outdir,0x100-currentlengt);
|
|
||||||
ExecScriptFunc(ExecStr);
|
|
||||||
RegCloseKey(hKey);
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
RegCloseKey(hKey);
|
|
||||||
}
|
|
||||||
MessageBoxW(0,Strings[IDS_UNZIP_ERROR],0,0);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void AddUninstallerScriptFunc(WCHAR* RegName, WCHAR* File) {
|
|
||||||
HKEY hKey1;
|
|
||||||
HKEY hKey2;
|
|
||||||
LPDWORD dispos = NULL;
|
|
||||||
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",0,KEY_WRITE,&hKey1) == ERROR_SUCCESS)
|
|
||||||
if (RegCreateKeyEx(hKey1,RegName,0,NULL,REG_OPTION_NON_VOLATILE,KEY_WRITE,NULL,&hKey2,dispos) == ERROR_SUCCESS) {
|
|
||||||
RegSetValueExW(hKey2,L"DisplayName",0,REG_SZ,(BYTE*)RegName,(lstrlen(RegName)+1)*sizeof(WCHAR));
|
|
||||||
RegSetValueExW(hKey2,L"UninstallString",0,REG_SZ,(BYTE*)File,(lstrlen(File)+1)*sizeof(WCHAR));
|
|
||||||
}
|
|
||||||
RegCloseKey(hKey2);
|
|
||||||
RegCloseKey(hKey1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void RemoveUninstallerScriptFunc(WCHAR* RegName) {
|
|
||||||
HKEY hKey1;
|
|
||||||
HKEY hKey2;
|
|
||||||
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",0,KEY_WRITE,&hKey1) == ERROR_SUCCESS) {
|
|
||||||
if (RegOpenKeyExW(hKey1,RegName,0,KEY_WRITE,&hKey2) == ERROR_SUCCESS) {
|
|
||||||
RegDeleteValueW(hKey2,L"DisplayName");
|
|
||||||
RegDeleteValueW(hKey2,L"UninstallString");
|
|
||||||
RegCloseKey(hKey2);
|
|
||||||
}
|
|
||||||
// RegDeleteKeyW(hKey1,RegName);
|
|
||||||
}
|
|
||||||
RegCloseKey(hKey1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void MessageScriptFunc(WCHAR* Text) {
|
|
||||||
MessageBoxW(0,Text,Strings[IDS_WINDOW_TITLE],0);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern void LoadScriptFunc(WCHAR*, struct ScriptElement*);
|
|
||||||
|
|
||||||
static void RunScript(struct Application* App, struct ScriptElement* Script) {
|
|
||||||
BOOL bRun = TRUE;
|
|
||||||
struct ScriptElement* p = Script;
|
|
||||||
INT SizeB = 0x100;
|
|
||||||
INT SizeA = sizeof(p->Arg)/sizeof(*(p->Arg));
|
|
||||||
INT i;
|
|
||||||
int currentlengt = 0;
|
|
||||||
WCHAR ArgBuffer[SizeA][SizeB];
|
|
||||||
WCHAR BufferA[SizeB];
|
|
||||||
WCHAR BufferB[SizeB];
|
|
||||||
WCHAR BufferC[SizeB];
|
|
||||||
WCHAR* Pos1;
|
|
||||||
WCHAR* Pos2;
|
|
||||||
WCHAR* Pos3 = NULL;
|
|
||||||
BOOL bNext;
|
|
||||||
while(bRun && (p != NULL)) {
|
|
||||||
|
|
||||||
for(i=0; i<SizeA; i++) {
|
|
||||||
bNext = TRUE;
|
|
||||||
wcscpy(BufferA, p->Arg[i]);
|
|
||||||
Pos1 = BufferA;
|
|
||||||
Pos2 = wcschr(Pos1, L'%');
|
|
||||||
if(!Pos2) {
|
|
||||||
wcscpy(ArgBuffer[i], Pos1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Pos2[0] = L'\0';
|
|
||||||
wcscpy(BufferB, Pos1);
|
|
||||||
Pos1 = Pos2 + 1;
|
|
||||||
Pos2 = wcschr(Pos1, L'%');
|
|
||||||
while (Pos2) {
|
|
||||||
Pos2[0] = L'\0';
|
|
||||||
if(bNext) {
|
|
||||||
if (wcscmp(Pos1, L"name") == 0) {
|
|
||||||
Pos3 = App->Name;
|
|
||||||
} else if (wcscmp(Pos1, L"regname") == 0) {
|
|
||||||
Pos3 = App->RegName;
|
|
||||||
} else if (wcscmp(Pos1, L"version") == 0) {
|
|
||||||
Pos3 = App->Version;
|
|
||||||
} else if (wcscmp(Pos1, L"maintainer") == 0) {
|
|
||||||
Pos3 = App->Maintainer;
|
|
||||||
} else if (wcscmp(Pos1, L"licence") == 0) {
|
|
||||||
Pos3 = App->Licence;
|
|
||||||
} else if (wcscmp(Pos1, L"description") == 0) {
|
|
||||||
Pos3 = App->Description;
|
|
||||||
} else if (wcscmp(Pos1, L"location") == 0) {
|
|
||||||
Pos3 = App->Location;
|
|
||||||
} else if (wcscmp(Pos1, L"regname_uninstaller") == 0) {
|
|
||||||
if (!getUninstaller(App, BufferC)) {
|
|
||||||
BufferC[0] = '\0';
|
|
||||||
}
|
|
||||||
Pos3 = BufferC;
|
|
||||||
} else if (wcscmp(Pos1, L"location_file") == 0) {
|
|
||||||
Pos3 = wcsrchr(App->Location, L'/');
|
|
||||||
if(Pos3 == NULL) {
|
|
||||||
BufferC[0] = '\0';
|
|
||||||
Pos3 = BufferC;
|
|
||||||
} else {
|
|
||||||
Pos3++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Pos3 = _wgetenv(Pos1);
|
|
||||||
}
|
|
||||||
bNext = !(Pos3);
|
|
||||||
if (bNext) {
|
|
||||||
Pos3 = Pos1;
|
|
||||||
currentlengt = lstrlenW(BufferB);
|
|
||||||
wcsncat(BufferB, L"%", SizeB-currentlengt);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Pos3 = Pos1;
|
|
||||||
bNext = TRUE;
|
|
||||||
}
|
|
||||||
currentlengt = lstrlenW(BufferB);
|
|
||||||
wcsncat(BufferB, Pos3, SizeB-currentlengt);
|
|
||||||
Pos1 = Pos2 + 1;
|
|
||||||
Pos2 = wcschr(Pos1, L'%');
|
|
||||||
}
|
|
||||||
if (bNext) {
|
|
||||||
wcsncat(BufferB, L"%", SizeB-currentlengt);
|
|
||||||
}
|
|
||||||
currentlengt = lstrlenW(BufferB);
|
|
||||||
wcsncat(BufferB, Pos1, SizeB-currentlengt);
|
|
||||||
wcscpy(ArgBuffer[i], BufferB);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wcscmp(p->Func, L"download") == 0) {
|
|
||||||
DownloadScriptFunc(ArgBuffer[0], ArgBuffer[1]);
|
|
||||||
} else if (wcscmp(p->Func, L"exec") == 0) {
|
|
||||||
ExecScriptFunc(ArgBuffer[0]);
|
|
||||||
} else if (wcscmp(p->Func, L"del") == 0) {
|
|
||||||
DelScriptFunc(ArgBuffer[0]);
|
|
||||||
} else if (wcscmp(p->Func, L"unzip") == 0) {
|
|
||||||
bRun = UnzipScriptFunc(ArgBuffer[0], ArgBuffer[1]);
|
|
||||||
} else if (wcscmp(p->Func, L"adduninstaller") == 0) {
|
|
||||||
AddUninstallerScriptFunc(ArgBuffer[0], ArgBuffer[1]);
|
|
||||||
} else if (wcscmp(p->Func, L"removeuninstaller") == 0) {
|
|
||||||
RemoveUninstallerScriptFunc(ArgBuffer[0]);
|
|
||||||
} else if (wcscmp(p->Func, L"message") == 0) {
|
|
||||||
MessageScriptFunc(ArgBuffer[0]);
|
|
||||||
} else if (wcscmp(p->Func, L"load") == 0) {
|
|
||||||
LoadScriptFunc(ArgBuffer[0],p);
|
|
||||||
}
|
|
||||||
p = p->Next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DWORD WINAPI InstallThreadFunc(LPVOID Context) {
|
|
||||||
struct Application* App = (struct Application*)Context;
|
|
||||||
|
|
||||||
if(App->InstallScript == NULL){
|
|
||||||
/* Default UninstallScript */
|
|
||||||
struct ScriptElement* Current;
|
|
||||||
Current = malloc(sizeof(struct ScriptElement));
|
|
||||||
App->InstallScript = Current;
|
|
||||||
memset(Current, 0, sizeof(struct ScriptElement));
|
|
||||||
wcscpy(Current->Func, L"load");
|
|
||||||
wcscpy(Current->Arg[0], L"script/default.install.xml");
|
|
||||||
}
|
|
||||||
|
|
||||||
RunScript(App, App->InstallScript);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DWORD WINAPI UninstallThreadFunc(LPVOID Context){
|
|
||||||
struct Application* App = (struct Application*)Context;
|
|
||||||
|
|
||||||
if(App->UninstallScript == NULL){
|
|
||||||
/* Default UninstallScript */
|
|
||||||
struct ScriptElement* Current;
|
|
||||||
Current = malloc(sizeof(struct ScriptElement));
|
|
||||||
App->UninstallScript = Current;
|
|
||||||
memset(Current, 0, sizeof(struct ScriptElement));
|
|
||||||
wcscpy(Current->Func, L"load");
|
|
||||||
wcscpy(Current->Arg[0], L"script/default.uninstall.xml");
|
|
||||||
}
|
|
||||||
|
|
||||||
RunScript(App, App->UninstallScript);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
|
@ -9,8 +9,6 @@ struct Application
|
||||||
WCHAR Description[0x400];
|
WCHAR Description[0x400];
|
||||||
WCHAR Location[0x100];
|
WCHAR Location[0x100];
|
||||||
struct Application* Next;
|
struct Application* Next;
|
||||||
struct ScriptElement* InstallScript;
|
|
||||||
struct ScriptElement* UninstallScript;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Category
|
struct Category
|
||||||
|
@ -24,17 +22,3 @@ struct Category
|
||||||
struct Category* Children;
|
struct Category* Children;
|
||||||
struct Category* Parent;
|
struct Category* Parent;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ScriptElement
|
|
||||||
{
|
|
||||||
WCHAR Func[0x100];
|
|
||||||
WCHAR Arg[2][0x100];
|
|
||||||
struct ScriptElement* Next;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct lParamDownload
|
|
||||||
{
|
|
||||||
HWND Dlg;
|
|
||||||
WCHAR* URL;
|
|
||||||
WCHAR* File;
|
|
||||||
};
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ STRINGTABLE DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_WINDOW_TITLE "Download ! - ReactOS Downloader"
|
IDS_WINDOW_TITLE "Download ! - ReactOS Downloader"
|
||||||
IDS_WELCOME_TITLE "Willkommen im ReactOS Downloader"
|
IDS_WELCOME_TITLE "Willkommen im ReactOS Downloader"
|
||||||
IDS_WELCOME "Bitte wählen Sie links eine Kategorie. Dies ist Version 1.0."
|
IDS_WELCOME "Bitte wählen Sie rechts eine Kategorie. Dies ist Version 1.0."
|
||||||
IDS_NO_APP_TITLE "Keine Anwendung ausgewählt"
|
IDS_NO_APP_TITLE "Keine Anwendung ausgewählt"
|
||||||
IDS_NO_APP "Bitte wählen Sie eine Anwendung, bevor Sie die Download-Schaltfläche betätigen. Wenn Sie Hilfe benötigen, drücken Sie die Hilfe-Schaltfläche in der oberen rechten Ecke."
|
IDS_NO_APP "Bitte wählen Sie eine Anwendung, bevor Sie die Download-Schaltfläche betätigen. Wenn Sie Hilfe benötigen, drücken Sie die Hilfe-Schaltfläche in der oberen rechten Ecke."
|
||||||
IDS_UPDATE_TITLE "Update"
|
IDS_UPDATE_TITLE "Update"
|
||||||
|
@ -29,7 +29,6 @@ BEGIN
|
||||||
IDS_XMLERROR_1 "XML Datei nicht gefunden!"
|
IDS_XMLERROR_1 "XML Datei nicht gefunden!"
|
||||||
IDS_XMLERROR_2 "XML Datei kann nicht verarbeitet werden!"
|
IDS_XMLERROR_2 "XML Datei kann nicht verarbeitet werden!"
|
||||||
IDS_DOWNLOAD_ERROR "Die Datei konnte nicht runtergeladen werden.\nBitte prüfen sie, ob eine Verbindung zum Internet besteht."
|
IDS_DOWNLOAD_ERROR "Die Datei konnte nicht runtergeladen werden.\nBitte prüfen sie, ob eine Verbindung zum Internet besteht."
|
||||||
IDS_UNZIP_ERROR "7-Zip nicht gefunden.\nBitte installieren Sie 7-Zip."
|
|
||||||
IDS_VERSION "Version: "
|
IDS_VERSION "Version: "
|
||||||
IDS_LICENCE "Lizenz: "
|
IDS_LICENCE "Lizenz: "
|
||||||
IDS_MAINTAINER "Maintainer: "
|
IDS_MAINTAINER "Maintainer: "
|
||||||
|
|
|
@ -14,7 +14,7 @@ STRINGTABLE DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_WINDOW_TITLE "Download ! - ReactOS Downloader"
|
IDS_WINDOW_TITLE "Download ! - ReactOS Downloader"
|
||||||
IDS_WELCOME_TITLE "Welcome to the ReactOS Downloader"
|
IDS_WELCOME_TITLE "Welcome to the ReactOS Downloader"
|
||||||
IDS_WELCOME "Please choose a category on the left. This is version 1.0."
|
IDS_WELCOME "Please choose a category on the right. This is version 1.0."
|
||||||
IDS_NO_APP_TITLE "No application selected"
|
IDS_NO_APP_TITLE "No application selected"
|
||||||
IDS_NO_APP "Please select a Application before you click the download button, if you need assistance please click on the question mark button on the top right corner."
|
IDS_NO_APP "Please select a Application before you click the download button, if you need assistance please click on the question mark button on the top right corner."
|
||||||
IDS_UPDATE_TITLE "Update"
|
IDS_UPDATE_TITLE "Update"
|
||||||
|
@ -29,7 +29,6 @@ BEGIN
|
||||||
IDS_XMLERROR_1 "Could not find the xml file !"
|
IDS_XMLERROR_1 "Could not find the xml file !"
|
||||||
IDS_XMLERROR_2 "Could not parse the xml file !"
|
IDS_XMLERROR_2 "Could not parse the xml file !"
|
||||||
IDS_DOWNLOAD_ERROR "Unable to download the file.\nPlease check you internet connection."
|
IDS_DOWNLOAD_ERROR "Unable to download the file.\nPlease check you internet connection."
|
||||||
IDS_UNZIP_ERROR "7-Zip not found.\nPlease install 7-Zip"
|
|
||||||
IDS_VERSION "Version: "
|
IDS_VERSION "Version: "
|
||||||
IDS_LICENCE "Licence: "
|
IDS_LICENCE "Licence: "
|
||||||
IDS_MAINTAINER "Maintainer: "
|
IDS_MAINTAINER "Maintainer: "
|
||||||
|
|
|
@ -29,7 +29,6 @@ BEGIN
|
||||||
IDS_XMLERROR_1 "Impossible de trouver le fichier xml !"
|
IDS_XMLERROR_1 "Impossible de trouver le fichier xml !"
|
||||||
IDS_XMLERROR_2 "Impossible d'analyser le fichier xml !"
|
IDS_XMLERROR_2 "Impossible d'analyser le fichier xml !"
|
||||||
IDS_DOWNLOAD_ERROR "Impossible de télécharger le fichier.\nVeuillez vérifier votre connexion Internet."
|
IDS_DOWNLOAD_ERROR "Impossible de télécharger le fichier.\nVeuillez vérifier votre connexion Internet."
|
||||||
IDS_UNZIP_ERROR "7-Zip not found.\nPlease install 7-Zip"
|
|
||||||
IDS_VERSION "Version: "
|
IDS_VERSION "Version: "
|
||||||
IDS_LICENCE "Licence: "
|
IDS_LICENCE "Licence: "
|
||||||
IDS_MAINTAINER "Maintainer: "
|
IDS_MAINTAINER "Maintainer: "
|
||||||
|
|
|
@ -29,7 +29,6 @@ BEGIN
|
||||||
IDS_XMLERROR_1 "Tidak dapat menemukan file xml !"
|
IDS_XMLERROR_1 "Tidak dapat menemukan file xml !"
|
||||||
IDS_XMLERROR_2 "Tidak dapat mengurai file xml !"
|
IDS_XMLERROR_2 "Tidak dapat mengurai file xml !"
|
||||||
IDS_DOWNLOAD_ERROR "Tidak bisa mendownload file.\nSilahkan periksa koneksi internet anda."
|
IDS_DOWNLOAD_ERROR "Tidak bisa mendownload file.\nSilahkan periksa koneksi internet anda."
|
||||||
IDS_UNZIP_ERROR "7-Zip not found.\nPlease install 7-Zip"
|
|
||||||
IDS_VERSION "Versi: "
|
IDS_VERSION "Versi: "
|
||||||
IDS_LICENCE "Lisensi: "
|
IDS_LICENCE "Lisensi: "
|
||||||
IDS_MAINTAINER "Pemelihara: "
|
IDS_MAINTAINER "Pemelihara: "
|
||||||
|
|
|
@ -29,7 +29,6 @@ BEGIN
|
||||||
IDS_XMLERROR_1 "File xml non trovato !"
|
IDS_XMLERROR_1 "File xml non trovato !"
|
||||||
IDS_XMLERROR_2 "Impossibile trattare il contenuto del file xml !"
|
IDS_XMLERROR_2 "Impossibile trattare il contenuto del file xml !"
|
||||||
IDS_DOWNLOAD_ERROR "Download del file impossibile.\nVerifica la connessione a Internet."
|
IDS_DOWNLOAD_ERROR "Download del file impossibile.\nVerifica la connessione a Internet."
|
||||||
IDS_UNZIP_ERROR "7-Zip not found.\nPlease install 7-Zip"
|
|
||||||
IDS_VERSION "Version: "
|
IDS_VERSION "Version: "
|
||||||
IDS_LICENCE "Licence: "
|
IDS_LICENCE "Licence: "
|
||||||
IDS_MAINTAINER "Maintainer: "
|
IDS_MAINTAINER "Maintainer: "
|
||||||
|
|
|
@ -10,153 +10,20 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <shlwapi.h>
|
#include <shlwapi.h>
|
||||||
#include <io.h>
|
|
||||||
#include "structures.h"
|
#include "structures.h"
|
||||||
#include "resources.h"
|
#include "resources.h"
|
||||||
|
|
||||||
BOOL TagOpen;
|
BOOL TagOpen;
|
||||||
BOOL InstallScriptOpen;
|
|
||||||
BOOL UninstallScriptOpen;
|
|
||||||
struct Category* Current;
|
struct Category* Current;
|
||||||
struct Application* CurrentApplication;
|
struct Application* CurrentApplication;
|
||||||
struct ScriptElement* CurrentScript;
|
|
||||||
char DML_Name[0x100];
|
|
||||||
char DML_Target[0x100];
|
|
||||||
char Path [0x100];
|
|
||||||
char CurrentTag [0x100];
|
char CurrentTag [0x100];
|
||||||
|
|
||||||
extern WCHAR Strings [STRING_COUNT][MAX_STRING_LENGHT];
|
extern WCHAR Strings [STRING_COUNT][MAX_STRING_LENGHT];
|
||||||
BOOL ImportXML (const char*);
|
|
||||||
|
|
||||||
void ImportFolder (const char* folder)
|
|
||||||
{
|
|
||||||
WCHAR buffer[0x100];
|
|
||||||
char buffer2[0x100];
|
|
||||||
struct _wfinddata_t Finddata;
|
|
||||||
DWORD Findhandle;
|
|
||||||
buffer[0]='\0';
|
|
||||||
strcpy(buffer2, Path);
|
|
||||||
strncat(buffer2, folder, 0x100-strlen(buffer2));
|
|
||||||
strncat(buffer2, "\\*.dml", 0x100-strlen(buffer2));
|
|
||||||
MultiByteToWideChar(CP_UTF8, 0, buffer2, -1, buffer, 0x100);
|
|
||||||
if((Findhandle=_wfindfirst(buffer, &Finddata)) == -1)
|
|
||||||
return;
|
|
||||||
do {
|
|
||||||
buffer[0]='\0';
|
|
||||||
MultiByteToWideChar(CP_UTF8, 0, folder, -1, buffer, 0x100);
|
|
||||||
wcsncat(buffer, L"\\", 0x100-wcslen(buffer));
|
|
||||||
wcsncat(buffer, Finddata.name, 0x100-wcslen(buffer));
|
|
||||||
WideCharToMultiByte(CP_UTF8, 0, buffer, -1, buffer2, 0x100, NULL, FALSE);
|
|
||||||
ImportXML(buffer2);
|
|
||||||
} while(_wfindnext(Findhandle, &Finddata)==0);
|
|
||||||
_findclose(Findhandle);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Script_tag_opened (void* usrdata, const char* tag, const char** arg)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
if (!strcmp(tag, "script")) {
|
|
||||||
return;
|
|
||||||
} else if (InstallScriptOpen && (CurrentScript == NULL)) {
|
|
||||||
CurrentApplication->InstallScript = malloc(sizeof(struct ScriptElement));
|
|
||||||
CurrentScript = CurrentApplication->InstallScript;
|
|
||||||
} else if (UninstallScriptOpen && (CurrentScript == NULL)) {
|
|
||||||
CurrentApplication->UninstallScript = malloc(sizeof(struct ScriptElement));
|
|
||||||
CurrentScript = CurrentApplication->UninstallScript;
|
|
||||||
} else if (CurrentScript != NULL) {
|
|
||||||
CurrentScript->Next = malloc(sizeof(struct ScriptElement));
|
|
||||||
CurrentScript = CurrentScript->Next;
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
memset(CurrentScript, 0, sizeof(struct ScriptElement));
|
|
||||||
if (!strcmp(tag, "download")) {
|
|
||||||
wcscpy(CurrentScript->Func, L"download");
|
|
||||||
for (i=0; arg[i]; i+=2) {
|
|
||||||
if(!strcmp(arg[i], "file")) {
|
|
||||||
MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, CurrentScript->Arg[1], 0x100);
|
|
||||||
} else if(!strcmp(arg[i], "url")) {
|
|
||||||
MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, CurrentScript->Arg[0], 0x100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (!strcmp(tag, "exec")) {
|
|
||||||
wcscpy(CurrentScript->Func, L"exec");
|
|
||||||
for (i=0; arg[i]; i+=2) {
|
|
||||||
if(!strcmp(arg[i], "file")) {
|
|
||||||
MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, CurrentScript->Arg[0], 0x100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (!strcmp(tag, "del")) {
|
|
||||||
wcscpy(CurrentScript->Func, L"del");
|
|
||||||
for (i=0; arg[i]; i+=2) {
|
|
||||||
if(!strcmp(arg[i], "file")) {
|
|
||||||
MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, CurrentScript->Arg[0], 0x100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (!strcmp(tag, "unzip")) {
|
|
||||||
wcscpy(CurrentScript->Func, L"unzip");
|
|
||||||
for (i=0; arg[i]; i+=2) {
|
|
||||||
if(!strcmp(arg[i], "file")) {
|
|
||||||
MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, CurrentScript->Arg[0], 0x100);
|
|
||||||
} else if(!strcmp(arg[i], "outdir")) {
|
|
||||||
MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, CurrentScript->Arg[1], 0x100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (!strcmp(tag, "adduninstaller")) {
|
|
||||||
wcscpy(CurrentScript->Func, L"adduninstaller");
|
|
||||||
for (i=0; arg[i]; i+=2) {
|
|
||||||
if(!strcmp(arg[i], "regname")) {
|
|
||||||
MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, CurrentScript->Arg[0], 0x100);
|
|
||||||
} else if(!strcmp(arg[i], "file")) {
|
|
||||||
MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, CurrentScript->Arg[1], 0x100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (!strcmp(tag, "removeuninstaller")) {
|
|
||||||
wcscpy(CurrentScript->Func, L"removeuninstaller");
|
|
||||||
for (i=0; arg[i]; i+=2) {
|
|
||||||
if(!strcmp(arg[i], "regname")) {
|
|
||||||
MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, CurrentScript->Arg[0], 0x100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (!strcmp(tag, "message")) {
|
|
||||||
wcscpy(CurrentScript->Func, L"message");
|
|
||||||
for (i=0; arg[i]; i+=2) {
|
|
||||||
if(!strcmp(arg[i], "text")) {
|
|
||||||
MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, CurrentScript->Arg[0], 0x100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (!strcmp(tag, "load")) {
|
|
||||||
wcscpy(CurrentScript->Func, L"load");
|
|
||||||
for (i=0; arg[i]; i+=2) {
|
|
||||||
if(!strcmp(arg[i], "file")) {
|
|
||||||
MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, CurrentScript->Arg[0], 0x100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
MessageBoxW(0,Strings[IDS_XMLERROR_2],0,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void tag_opened (void* usrdata, const char* tag, const char** arg)
|
void tag_opened (void* usrdata, const char* tag, const char** arg)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(!strcmp(tag, "import"))
|
if(!strcmp(tag, "tree") && !CurrentApplication)
|
||||||
{
|
|
||||||
for (i=0; arg[i]; i+=2)
|
|
||||||
{
|
|
||||||
if(!strcmp(arg[i], "file"))
|
|
||||||
{
|
|
||||||
ImportXML(arg[i+1]);
|
|
||||||
}
|
|
||||||
else if(!strcmp(arg[i], "folder"))
|
|
||||||
{
|
|
||||||
ImportFolder(arg[i+1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(!strcmp(tag, "tree") && !CurrentApplication)
|
|
||||||
{
|
{
|
||||||
// check version
|
// check version
|
||||||
}
|
}
|
||||||
|
@ -225,16 +92,7 @@ void tag_opened (void* usrdata, const char* tag, const char** arg)
|
||||||
}
|
}
|
||||||
else if (CurrentApplication)
|
else if (CurrentApplication)
|
||||||
{
|
{
|
||||||
if (!strcmp(tag, "installscript")) {
|
strncpy(CurrentTag, tag, 0x100);
|
||||||
InstallScriptOpen = TRUE;
|
|
||||||
} else if (!strcmp(tag, "uninstallscript")) {
|
|
||||||
UninstallScriptOpen = TRUE;
|
|
||||||
} else {
|
|
||||||
Script_tag_opened(usrdata, tag, arg);
|
|
||||||
if (CurrentScript == NULL) {
|
|
||||||
strncpy(CurrentTag, tag, 0x100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
MessageBoxW(0,Strings[IDS_XMLERROR_2],0,0);
|
MessageBoxW(0,Strings[IDS_XMLERROR_2],0,0);
|
||||||
|
@ -297,27 +155,30 @@ void tag_closed (void* tree, const char* tag)
|
||||||
{
|
{
|
||||||
CurrentApplication = NULL;
|
CurrentApplication = NULL;
|
||||||
}
|
}
|
||||||
else if(!strcmp(tag, "installscript") || !strcmp(tag, "uninstallscript"))
|
|
||||||
{
|
|
||||||
CurrentScript = NULL;
|
|
||||||
InstallScriptOpen = FALSE;
|
|
||||||
UninstallScriptOpen = FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL ImportXML (const char* filename)
|
BOOL ProcessXML (const char* filename, struct Category* Root)
|
||||||
{
|
{
|
||||||
int done = 0;
|
int done = 0;
|
||||||
char buffer[0x100];
|
char buffer[255];
|
||||||
FILE* file;
|
FILE* file;
|
||||||
XML_Parser parser;
|
XML_Parser parser;
|
||||||
strcpy(buffer, Path);
|
|
||||||
strncat(buffer, filename, 0x100-strlen(buffer));
|
if(Current)
|
||||||
file = fopen(buffer, "r");
|
return FALSE;
|
||||||
|
|
||||||
|
Current = Root;
|
||||||
|
TagOpen = TRUE;
|
||||||
|
|
||||||
|
file = fopen(filename, "r");
|
||||||
if(!file)
|
if(!file)
|
||||||
{
|
{
|
||||||
MessageBoxW(0,Strings[IDS_XMLERROR_1],0,0);
|
file = fopen("downloader.xml", "r");
|
||||||
return FALSE;
|
if(!file)
|
||||||
|
{
|
||||||
|
MessageBoxW(0,Strings[IDS_XMLERROR_1],0,0);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parser = XML_ParserCreate(NULL);
|
parser = XML_ParserCreate(NULL);
|
||||||
|
@ -343,169 +204,10 @@ BOOL ImportXML (const char* filename)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL ProcessXML (const char* filename, struct Category* Root)
|
|
||||||
{
|
|
||||||
FILE* file;
|
|
||||||
file = fopen(filename, "r");
|
|
||||||
if(file)
|
|
||||||
{
|
|
||||||
Path[0]='\0';
|
|
||||||
fclose(file);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
strncpy(Path, getenv("SystemRoot"), 0x100-13);
|
|
||||||
strcat(Path, "\\packagetree\\");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Current)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
Current = Root;
|
|
||||||
CurrentApplication = NULL;
|
|
||||||
CurrentScript = NULL;
|
|
||||||
TagOpen = TRUE;
|
|
||||||
InstallScriptOpen = FALSE;
|
|
||||||
UninstallScriptOpen = FALSE;
|
|
||||||
|
|
||||||
return ImportXML(filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DML_tag_opened (void* usrdata, const char* tag, const char** arg)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if(!strcmp(tag, "application"))
|
|
||||||
{
|
|
||||||
for (i=0; arg[i]; i+=2)
|
|
||||||
{
|
|
||||||
if(!strcmp(arg[i], "name"))
|
|
||||||
{
|
|
||||||
strncpy(DML_Name, arg[i+1], 0x100);
|
|
||||||
}
|
|
||||||
else if(!strcmp(arg[i], "target"))
|
|
||||||
{
|
|
||||||
strncpy(DML_Target, arg[i+1], 0x100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void NOP_text (void* usrdata, const char* data, int len)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void NOP_tag_closed (void* tree, const char* tag)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
char* addDML (const char* filename)
|
|
||||||
{
|
|
||||||
int done = 0;
|
|
||||||
char buffer[0x100];
|
|
||||||
FILE* file;
|
|
||||||
XML_Parser parser;
|
|
||||||
DML_Target[0] = '\0';
|
|
||||||
file = fopen(filename, "r");
|
|
||||||
if(!file)
|
|
||||||
{
|
|
||||||
MessageBoxW(0,Strings[IDS_XMLERROR_1],0,0);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
parser = XML_ParserCreate(NULL);
|
|
||||||
XML_SetElementHandler(parser, DML_tag_opened, NOP_tag_closed);
|
|
||||||
XML_SetCharacterDataHandler(parser, NOP_text);
|
|
||||||
|
|
||||||
while (!done)
|
|
||||||
{
|
|
||||||
size_t len = fread (buffer, 1, sizeof(buffer), file);
|
|
||||||
done = len < sizeof(buffer);
|
|
||||||
|
|
||||||
buffer[len] = 0;
|
|
||||||
if(!XML_Parse(parser, buffer, len, done))
|
|
||||||
{
|
|
||||||
MessageBoxW(0,Strings[IDS_XMLERROR_2],0,0);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
XML_ParserFree(parser);
|
|
||||||
fclose(file);
|
|
||||||
|
|
||||||
if(DML_Target[0]=='\0')
|
|
||||||
{
|
|
||||||
MessageBoxW(0,Strings[IDS_XMLERROR_2],0,0);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
strcpy(buffer, getenv("SystemRoot"));
|
|
||||||
strncat(buffer, "\\packagetree\\", 0x100-strlen(buffer));
|
|
||||||
strncat(buffer, DML_Target, 0x100-strlen(buffer));
|
|
||||||
|
|
||||||
CopyFileA(filename, buffer, FALSE);
|
|
||||||
return DML_Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LoadScriptFunc(WCHAR* filenameW, struct ScriptElement* Script)
|
|
||||||
{
|
|
||||||
int done = 0;
|
|
||||||
char buffer[0x100];
|
|
||||||
char filenameA[0x100];
|
|
||||||
FILE* file;
|
|
||||||
XML_Parser parser;
|
|
||||||
struct ScriptElement* NextElement = Script->Next;
|
|
||||||
wcscpy(Script->Func,L"NOP");
|
|
||||||
CurrentScript = Script;
|
|
||||||
WideCharToMultiByte(CP_UTF8, 0, filenameW, -1, filenameA, 0x100, NULL, FALSE);
|
|
||||||
strcpy(buffer, Path);
|
|
||||||
strncat(buffer, filenameA, 0x100-strlen(buffer));
|
|
||||||
file = fopen(buffer, "r");
|
|
||||||
if(!file)
|
|
||||||
{
|
|
||||||
MessageBoxW(0,Strings[IDS_XMLERROR_1],0,0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
parser = XML_ParserCreate(NULL);
|
|
||||||
XML_SetElementHandler(parser, Script_tag_opened, NOP_tag_closed);
|
|
||||||
XML_SetCharacterDataHandler(parser, NOP_text);
|
|
||||||
|
|
||||||
while (!done)
|
|
||||||
{
|
|
||||||
size_t len = fread (buffer, 1, sizeof(buffer), file);
|
|
||||||
done = len < sizeof(buffer);
|
|
||||||
|
|
||||||
buffer[len] = 0;
|
|
||||||
if(!XML_Parse(parser, buffer, len, done))
|
|
||||||
{
|
|
||||||
MessageBoxW(0,Strings[IDS_XMLERROR_2],0,0);
|
|
||||||
CurrentScript->Next = NextElement;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
XML_ParserFree(parser);
|
|
||||||
fclose(file);
|
|
||||||
CurrentScript->Next = NextElement;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FreeScript (struct ScriptElement* Script)
|
|
||||||
{
|
|
||||||
if (Script->Next != NULL)
|
|
||||||
FreeScript(Script->Next);
|
|
||||||
free(Script);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FreeApps (struct Application* Apps)
|
void FreeApps (struct Application* Apps)
|
||||||
{
|
{
|
||||||
if (Apps->Next)
|
if (Apps->Next)
|
||||||
FreeApps(Apps->Next);
|
FreeApps(Apps->Next);
|
||||||
if (Apps->InstallScript)
|
|
||||||
FreeScript(Apps->InstallScript);
|
|
||||||
if (Apps->UninstallScript)
|
|
||||||
FreeScript(Apps->UninstallScript);
|
|
||||||
|
|
||||||
free(Apps);
|
free(Apps);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue