Author: mbosma Date: Fri Mar 2 20:27:39 2007 New Revision: 25952
URL: http://svn.reactos.org/svn/reactos?rev=25952&view=rev Log: Lester Kortenhoeven (lester(at)kortenhoeven(dot)de): Implement scripting.
Added: trunk/reactos/base/applications/downloader/packagetree/ trunk/reactos/base/applications/downloader/packagetree/internet/ trunk/reactos/base/applications/downloader/packagetree/internet/browser/ trunk/reactos/base/applications/downloader/packagetree/internet/browser/browser.rbuild trunk/reactos/base/applications/downloader/packagetree/internet/browser/firefox.1.5.0.9.dml trunk/reactos/base/applications/downloader/packagetree/internet/browser/firefox.2.0.0.1.dml trunk/reactos/base/applications/downloader/packagetree/internet/category.xml trunk/reactos/base/applications/downloader/packagetree/internet/internet.rbuild trunk/reactos/base/applications/downloader/packagetree/packagetree.rbuild trunk/reactos/base/applications/downloader/packagetree/script/ trunk/reactos/base/applications/downloader/packagetree/script/default.install.xml trunk/reactos/base/applications/downloader/packagetree/script/default.uninstall.xml trunk/reactos/base/applications/downloader/packagetree/script/script.rbuild trunk/reactos/base/applications/downloader/packagetree/tree.xml trunk/reactos/base/applications/downloader/script.c (with props) Removed: trunk/reactos/base/applications/downloader/downloader.xml Modified: trunk/reactos/base/applications/downloader/download.c trunk/reactos/base/applications/downloader/downloader.rbuild trunk/reactos/base/applications/downloader/main.c trunk/reactos/base/applications/downloader/resources.h trunk/reactos/base/applications/downloader/structures.h trunk/reactos/base/applications/downloader/translations/de.rc trunk/reactos/base/applications/downloader/translations/en.rc trunk/reactos/base/applications/downloader/translations/fr.rc trunk/reactos/base/applications/downloader/translations/id.rc trunk/reactos/base/applications/downloader/translations/it.rc trunk/reactos/base/applications/downloader/xml.c
Modified: trunk/reactos/base/applications/downloader/download.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/downloade... ============================================================================== --- trunk/reactos/base/applications/downloader/download.c (original) +++ trunk/reactos/base/applications/downloader/download.c Fri Mar 2 20:27:39 2007 @@ -221,31 +221,11 @@ { //static const WCHAR szUrl[] = DownloadUrl; IBindStatusCallback *dl; - WCHAR path[MAX_PATH]; - LPWSTR p; - STARTUPINFOW si; - PROCESS_INFORMATION pi; - HWND Dlg = (HWND) Context; + HWND Dlg = ((struct lParamDownload*)Context)->Dlg; DWORD r; BOOL bCancelled = FALSE; - BOOL bTempfile = FALSE; - - /* 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); + dl = CreateDl(Dlg, &bCancelled); + r = URLDownloadToFileW(NULL, ((struct lParamDownload*)Context)->URL, ((struct lParamDownload*)Context)->File, 0, dl); if (NULL != dl) { IBindStatusCallback_Release(dl); @@ -253,30 +233,6 @@ if (S_OK != r) { 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); return 0; @@ -287,7 +243,7 @@ { HANDLE Thread; DWORD ThreadId; - HWND Item; + HWND Item;;
switch (Msg) { @@ -320,7 +276,8 @@ ShowWindow(Item, SW_HIDE); } }*/ - Thread = CreateThread(NULL, 0, ThreadFunc, Dlg, 0, &ThreadId); + ((struct lParamDownload*)lParam)->Dlg = Dlg; + Thread = CreateThread(NULL, 0, ThreadFunc, (LPVOID)lParam, 0, &ThreadId); if (NULL == Thread) { return FALSE;
Modified: trunk/reactos/base/applications/downloader/downloader.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/downloade... ============================================================================== --- trunk/reactos/base/applications/downloader/downloader.rbuild (original) +++ trunk/reactos/base/applications/downloader/downloader.rbuild Fri Mar 2 20:27:39 2007 @@ -1,6 +1,8 @@ <?xml version="1.0"?> <!DOCTYPE project SYSTEM "tools/rbuild/project.dtd"> -<installfile base="system32">downloader.xml</installfile> +<directory name="packagetree"> + <xi:include href="packagetree/packagetree.rbuild" /> +</directory> <module name="downloader" type="win32gui" installbase="system32" installname="downloader.exe"> <include base="downloader">.</include> <include base="expat">.</include> @@ -27,5 +29,6 @@ <file>main.c</file> <file>xml.c</file> <file>download.c</file> + <file>script.c</file> <file>downloader.rc</file> </module>
Removed: trunk/reactos/base/applications/downloader/downloader.xml URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/downloade... ============================================================================== --- trunk/reactos/base/applications/downloader/downloader.xml (original) +++ trunk/reactos/base/applications/downloader/downloader.xml (removed) @@ -1,182 +1,0 @@ -<tree Version="1"> <!-- Application version this tree is made for --> - <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/win...</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/win3...</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/...</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/sea...</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...</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....</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"> - <application name="Abiword"> - <regname>"AbiWord 2.4.1 (remove only)"</regname> - <version>2.4.1</version> - <description>Word processor.</description> - <location>http://www.abiword.org/downloads/abiword/2.4.1/Windows/abiword-setup-2.4.1.e...</location> - </application> - <application name="OpenOffice"> - <regname>OpenOffice.org 2.1</regname> - <version>2.1.0</version> - <description>THE Open Source Office Suite.</description> - <location>http://ftp.tu-chemnitz.de/pub/openoffice-extended//stable/2.1.0/OOo_2.1.0_Wi...</location> - </application> - </category> - <category name="Graphics" icon="3"> - <application name="IrfanView"> - <regname>IrfanView (remove only)</regname> - <version>3.99</version> - <description>Viewer for all kinds of graphics/audio files/video files.</description> - <location>http://gd.tuwien.ac.at/graphics/irfanview/iview399.exe</location> - </application> - <application name="IrfanView Plugins"> - <version>3.99</version> - <description>Additional Plugins for supporting more file types.</description> - <location>http://irfanview.tuwien.ac.at/plugins/irfanview_plugins_399.exe</location> - </application> - <application name="TuxPaint"> - <regname>Tux Paint 0.9.16</regname> - <version>0.9.16</version> - <description>An open source bitmap graphics editor geared towards young children.</description> - <location>http://ovh.dl.sourceforge.net/sourceforge/tuxpaint/tuxpaint-0.9.16-win32-ins...</location> - </application> - </category> - <category name="Multimedia" icon="4"> - </category> - <category name="Development" icon="5"> - <application name="ReactOS Build Environment"> - <regname>ReactOS Build Environment 0.3.4</regname> - <version>0.3.4</version> - <description>Allows you to build the ReactOS Source. For more instructions see ReactOS wiki.</description> - <location>http://ovh.dl.sourceforge.net/sourceforge/reactos/RosBE-0.3.4.exe</location> - </application> - <application name="MinGW"> - <regname>MinGW 5.1.3</regname> - <version>5.1.3</version> - <description>A Port of the GNU toolchain with GCC, GDB, GNU make, etc.</description> - <location>http://puzzle.dl.sourceforge.net/sourceforge/mingw/MinGW-5.1.3.exe</location> - </application> - <application name="FreeBASIC"> - <regname>FreeBASIC 0.16b</regname> - <version>0.16b</version> - <description>Open Source Basic Compiler. The Basic syntax is compatible to QBASIC.</description> - <location>http://switch.dl.sourceforge.net/sourceforge/fbc/FreeBASIC-v0.16b-win32.exe</location> - </application> - </category> - <category name="Games & Fun" icon="6"> - <application name="ScummVM"> - <regname>ScummVM 0.9.1</regname> - <version>0.9.1</version> - <description>SamNMax, Day of Tentacle, etc on ReactOS</description> - <location>http://ovh.dl.sourceforge.net/sourceforge/scummvm/scummvm-0.9.1-win32.exe</location> - </application> - <application name="Tile World"> - <description>Nice Clone of Chip's Challenge originally made for the Atari Lynx. Includes free CCLP2 Graphics Pack, so you dont need the copyrighted Original.</description> - <location>http://www.muppetlabs.com/~breadbox/pub/software/tworld/tworld-1.3.0-win32-C...</location> - </application> - <application name="OpenTTD"> - <regname>OpenTTD 0.5.0</regname> - <version>0.5.0-RC5</version> - <description>Open-source-clone of the "Transport Tycoon Deluxe" game-engine. You need a copy of Transport Tycoon.</description> - <location>http://ovh.dl.sourceforge.net/sourceforge/openttd/openttd-0.5.0-RC5-win32.ex...</location> - </application> - <application name="LBreakout2">LBreakout2 2.4.1 - <regname>LBreakout2 2.4.1</regname> - <version>2.4.1</version> - <description>Breakout Clone using SDL libs.</description> - <location>http://switch.dl.sourceforge.net/sourceforge/lgames/lbreakout2-2.4.1-win32.e...</location> - </application> - <application name="LGeneral"> - <regname>LGeneral 1.1</regname> - <version>1.1</version> - <description>Panzer General Clone using SDL libs.</description> - <location>http://kent.dl.sourceforge.net/sourceforge/lgames/lgeneral-1.1-win32.exe</location> - </application> - <application name="LMarbles"> - <regname>LMarbles 1.0.6</regname> - <version>1.0.6</version> - <description>Atomix Clone using SDL libs.</description> - <location>http://heanet.dl.sourceforge.net/sourceforge/lgames/lmarbles-1.0.6-win32.exe</location> - </application> - </category> - <category name="Tools" icon="7"> - <application name="7-Zip"> - <regname>7-Zip 4.42</regname> - <version>4.42</version> - <description>Utility to create and open 7zip, zip, tar, rar and other archive files.</description> - <location>http://ovh.dl.sourceforge.net/sourceforge/sevenzip/7z442.exe</location> - </application> - <application name="uTorrent"> - <regname>µTorrent</regname> - <version>1.6</version> - <description>Small and fast Torrent Client.</description> - <location>http://download.utorrent.com/1.6/uTorrent-1.6-install.exe</location> - </application> - <application name="Audio Grabber"> - <regname>Audiograbber 1.83 SE </regname> - <version>1.83 SE</version> - <description>A very good CD Ripper/Audio File Converter.</description> - <location>http://www.audiograbber.de/files/342677432/agsetup183se.exe</location> - </application> - </category> - <category name="Others" icon="8"> - <application name="Simple Direct Media Layer (SDL) Runtime"> - <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> - <location>http://ovh.dl.sourceforge.net/sourceforge/libsdl/SDL-1.2.11-win32.zip</location> - </application> - <application name="DOSBox"> - <version>0.65</version> - <description>DOSBox is a DOS emulator.</description> - <location>http://puzzle.dl.sourceforge.net/sourceforge/dosbox/DOSBox0.65-win32-install...</location> - </application> - </category> -</tree>
Modified: trunk/reactos/base/applications/downloader/main.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/downloade... ============================================================================== --- trunk/reactos/base/applications/downloader/main.c (original) +++ trunk/reactos/base/applications/downloader/main.c Fri Mar 2 20:27:39 2007 @@ -10,46 +10,65 @@ #include <richedit.h> #include <stdio.h> #include <shlwapi.h> +#include <wchar.h> #include "resources.h" #include "structures.h"
-#define XML_PATH "C:\ReactOS\system32\downloader.xml" +#define XML_PATH "tree.xml"
HWND hwnd, hCategories, hApps, hDownloadButton, hUninstallButton, hUpdateButton, hHelpButton; HBITMAP hLogo, hUnderline; +CHAR* CmdLine; WCHAR* DescriptionHeadline = L""; WCHAR* DescriptionText = L""; -WCHAR ApplicationText[700]; - +WCHAR ApplicationText[0xA04]; // MAX_STRING_LENGHT + Version + \n + MAX_STRING_LENGHT + Licence + \n + MAX_STRING_LENGHT + Maintainer + \n\n + Description + // 0x100 + 0x100 + 1 + 0x100 + 0x100 + 1 + 0x100 + 0x100 + 2 + 0x400 = 0xA04 struct Category Root; struct Application* SelectedApplication;
INT_PTR CALLBACK DownloadProc (HWND, UINT, WPARAM, LPARAM); +DWORD WINAPI InstallThreadFunc(LPVOID); +DWORD WINAPI UninstallThreadFunc(LPVOID); BOOL ProcessXML (const char* filename, struct Category* Root); +char* addDML (const char*); VOID FreeTree (struct Category* Node); WCHAR Strings [STRING_COUNT][MAX_STRING_LENGHT];
- -BOOL getUninstaller(WCHAR* RegName, WCHAR* Uninstaller) { - - const DWORD ArraySize = 200; +BOOL getUninstaller(struct Application* CurrentApplication, WCHAR* Uninstaller) { + + DWORD ArraySize = 0x100;
HKEY hKey1; HKEY hKey2; DWORD Type = 0; - DWORD Size = ArraySize; WCHAR Value[ArraySize]; WCHAR KeyName[ArraySize]; + DWORD Size = ArraySize; 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(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) { ++i; RegOpenKeyExW(hKey1,KeyName,0,KEY_READ,&hKey2); - Size = ArraySize; + Size = sizeof(Value); if (RegQueryValueExW(hKey2,L"DisplayName",0,&Type,(LPBYTE)Value,&Size) == ERROR_SUCCESS) { Size = ArraySize; - if (StrCmpW(Value,RegName) == 0) { + if (!wcscmp(Value,CurrentApplication->RegName)) { if (RegQueryValueExW(hKey2,L"UninstallString",0,&Type,(LPBYTE)Uninstaller,&Size) == ERROR_SUCCESS) { RegCloseKey(hKey2); RegCloseKey(hKey1); @@ -123,17 +142,16 @@
CurrentApplication = Category->Apps;
- WCHAR Uninstaller[200]; while(CurrentApplication) { Insert.item.lParam = (UINT)CurrentApplication; Insert.item.pszText = CurrentApplication->Name; Insert.item.cchTextMax = lstrlenW(CurrentApplication->Name); - Insert.item.iImage = 10; - if(StrCmpW(CurrentApplication->RegName,L"")) { - if(getUninstaller(CurrentApplication->RegName, Uninstaller)) - Insert.item.iImage = 9; - } + if(getUninstaller(CurrentApplication, NULL)) { + Insert.item.iImage = 9; + } else { + Insert.item.iImage = 10; + } SendMessage(hwnd, TVM_INSERTITEM, 0, (LPARAM)&Insert); CurrentApplication = CurrentApplication->Next; } @@ -161,8 +179,8 @@
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); - 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, 33, hwnd, 0, hInstance, NULL); + hDownloadButton = CreateWindowW (L"Button", L"", WS_CHILD|WS_VISIBLE|BS_BITMAP, 330, 505, 140, 35, hwnd, 0, hInstance, NULL); + hUninstallButton = CreateWindowW (L"Button", L"", WS_CHILD|WS_VISIBLE|BS_BITMAP, 260, 505, 140, 35, hwnd, 0, hInstance, NULL);
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))); @@ -267,17 +285,41 @@ MoveWindow(hDownloadButton,(Split_Vertical+Rect.right-Rect.left)/2-70,Rect.bottom-Rect.top-45,140,35,TRUE); }
-void startUninstaller(WCHAR* Uninstaller) { - STARTUPINFOW si; - PROCESS_INFORMATION pi; - - memset(&si, 0, sizeof(si)); - si.cb = sizeof(si); - CreateProcessW(NULL,Uninstaller,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi); - CloseHandle(pi.hThread); - // WaitForSingleObject(pi.hProcess, INFINITE); // If you want to wait for the Unistaller - CloseHandle(pi.hProcess); - hideUninstaller(); +void searchApp(const WCHAR* AppName, struct Category* Node) { + struct Application* CurrentApplication; + if (Node->Children) + 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() { + ApplicationText[0]=L'\0'; + if(SelectedApplication->Version[0] != L'\0') { + StrCatW(ApplicationText, Strings[IDS_VERSION]); + StrCatW(ApplicationText, SelectedApplication->Version); + StrCatW(ApplicationText, L"\n"); + } + 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) @@ -288,9 +330,34 @@ { 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)) 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;
@@ -319,21 +386,20 @@ { if (lParam == (LPARAM)hDownloadButton) { - if(SelectedApplication) - DialogBoxW(GetModuleHandle(NULL), MAKEINTRESOURCEW(IDD_DOWNLOAD), 0, DownloadProc); - else + if(SelectedApplication) { + DWORD ThreadId; + CreateThread(NULL, 0, InstallThreadFunc, SelectedApplication, 0, &ThreadId); + } else ShowMessage(Strings[IDS_NO_APP_TITLE], Strings[IDS_NO_APP]); } else if (lParam == (LPARAM)hUninstallButton) { - if(SelectedApplication) - { - WCHAR Uninstaller[200]; - if(StrCmpW(SelectedApplication->RegName, L"")) { - if(getUninstaller(SelectedApplication->RegName, Uninstaller)) - startUninstaller(Uninstaller); - } - } + if(SelectedApplication) { + DWORD ThreadId; + CreateThread(NULL, 0, UninstallThreadFunc, SelectedApplication, 0, &ThreadId); + hideUninstaller(); + } else + ShowMessage(Strings[IDS_NO_APP_TITLE], Strings[IDS_NO_APP]); } else if (lParam == (LPARAM)hUpdateButton) { @@ -363,31 +429,9 @@ SelectedApplication = (struct Application*) ((LPNMTREEVIEW)lParam)->itemNew.lParam; if(SelectedApplication) { - ApplicationText[0]=L'\0'; - if(StrCmpW(SelectedApplication->Version, L"")) { - 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; - } + ShowSelectedApplication(); + if(getUninstaller(SelectedApplication, NULL)) { + bShowUninstaller = TRUE; } } } @@ -452,7 +496,8 @@ MSG msg;
InitCommonControls(); - + CmdLine = lpCmdLine; + // Load strings for(i=0; i<STRING_COUNT; i++) LoadStringW(hInstance, i, Strings[i], MAX_STRING_LENGHT); // if you know a better method please tell me.
Added: trunk/reactos/base/applications/downloader/packagetree/internet/browser/browser.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/downloade... ============================================================================== --- trunk/reactos/base/applications/downloader/packagetree/internet/browser/browser.rbuild (added) +++ trunk/reactos/base/applications/downloader/packagetree/internet/browser/browser.rbuild Fri Mar 2 20:27:39 2007 @@ -1,0 +1,4 @@ +<?xml version="1.0"?> +<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd"> +<installfile base="packagetree\internet\browser">firefox.1.5.0.9.dml</installfile> +<installfile base="packagetree\internet\browser">firefox.2.0.0.1.dml</installfile>
Added: trunk/reactos/base/applications/downloader/packagetree/internet/browser/firefox.1.5.0.9.dml URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/downloade... ============================================================================== --- trunk/reactos/base/applications/downloader/packagetree/internet/browser/firefox.1.5.0.9.dml (added) +++ trunk/reactos/base/applications/downloader/packagetree/internet/browser/firefox.1.5.0.9.dml Fri Mar 2 20:27:39 2007 @@ -1,0 +1,7 @@ +<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/win...</location> +</application>
Added: trunk/reactos/base/applications/downloader/packagetree/internet/browser/firefox.2.0.0.1.dml URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/downloade... ============================================================================== --- trunk/reactos/base/applications/downloader/packagetree/internet/browser/firefox.2.0.0.1.dml (added) +++ trunk/reactos/base/applications/downloader/packagetree/internet/browser/firefox.2.0.0.1.dml Fri Mar 2 20:27:39 2007 @@ -1,0 +1,7 @@ +<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/win3...</location> +</application>
Added: trunk/reactos/base/applications/downloader/packagetree/internet/category.xml URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/downloade... ============================================================================== --- trunk/reactos/base/applications/downloader/packagetree/internet/category.xml (added) +++ trunk/reactos/base/applications/downloader/packagetree/internet/category.xml Fri Mar 2 20:27:39 2007 @@ -1,0 +1,54 @@ +<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/...</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/sea...</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...</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....</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>
Added: trunk/reactos/base/applications/downloader/packagetree/internet/internet.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/downloade... ============================================================================== --- trunk/reactos/base/applications/downloader/packagetree/internet/internet.rbuild (added) +++ trunk/reactos/base/applications/downloader/packagetree/internet/internet.rbuild Fri Mar 2 20:27:39 2007 @@ -1,0 +1,6 @@ +<?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>
Added: trunk/reactos/base/applications/downloader/packagetree/packagetree.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/downloade... ============================================================================== --- trunk/reactos/base/applications/downloader/packagetree/packagetree.rbuild (added) +++ trunk/reactos/base/applications/downloader/packagetree/packagetree.rbuild Fri Mar 2 20:27:39 2007 @@ -1,0 +1,9 @@ +<?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>
Added: trunk/reactos/base/applications/downloader/packagetree/script/default.install.xml URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/downloade... ============================================================================== --- trunk/reactos/base/applications/downloader/packagetree/script/default.install.xml (added) +++ trunk/reactos/base/applications/downloader/packagetree/script/default.install.xml Fri Mar 2 20:27:39 2007 @@ -1,0 +1,5 @@ +<script> + <download url="%location%" file="%TEMP%\%location_file%" /> + <exec file="%TEMP%\%location_file%" /> + <del file="%TEMP%\%location_file%" /> +</script>
Added: trunk/reactos/base/applications/downloader/packagetree/script/default.uninstall.xml URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/downloade... ============================================================================== --- trunk/reactos/base/applications/downloader/packagetree/script/default.uninstall.xml (added) +++ trunk/reactos/base/applications/downloader/packagetree/script/default.uninstall.xml Fri Mar 2 20:27:39 2007 @@ -1,0 +1,1 @@ +<exec file="%regname_uninstaller%" />
Added: trunk/reactos/base/applications/downloader/packagetree/script/script.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/downloade... ============================================================================== --- trunk/reactos/base/applications/downloader/packagetree/script/script.rbuild (added) +++ trunk/reactos/base/applications/downloader/packagetree/script/script.rbuild Fri Mar 2 20:27:39 2007 @@ -1,0 +1,3 @@ +<?xml version="1.0"?> +<installfile base="packagetree/script">default.install.xml</installfile> +<installfile base="packagetree/script">default.uninstall.xml</installfile>
Added: trunk/reactos/base/applications/downloader/packagetree/tree.xml URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/downloade... ============================================================================== --- trunk/reactos/base/applications/downloader/packagetree/tree.xml (added) +++ trunk/reactos/base/applications/downloader/packagetree/tree.xml Fri Mar 2 20:27:39 2007 @@ -1,0 +1,142 @@ +<tree Version="1"> <!-- Application version this tree is made for --> + <import file="internet\category.xml" /> + <category name="Office" icon="2"> + <application name="Abiword"> + <regname>"AbiWord 2.4.1 (remove only)"</regname> + <version>2.4.1</version> + <description>Word processor.</description> + <location>http://www.abiword.org/downloads/abiword/2.4.1/Windows/abiword-setup-2.4.1.e...</location> + </application> + <application name="OpenOffice"> + <regname>OpenOffice.org 2.1</regname> + <version>2.1.0</version> + <description>THE Open Source Office Suite.</description> + <location>http://ftp.tu-chemnitz.de/pub/openoffice-extended//stable/2.1.0/OOo_2.1.0_Wi...</location> + </application> + </category> + <category name="Graphics" icon="3"> + <application name="IrfanView"> + <regname>IrfanView (remove only)</regname> + <version>3.99</version> + <description>Viewer for all kinds of graphics/audio files/video files.</description> + <location>http://gd.tuwien.ac.at/graphics/irfanview/iview399.exe</location> + </application> + <application name="IrfanView Plugins"> + <version>3.99</version> + <description>Additional Plugins for supporting more file types.</description> + <location>http://irfanview.tuwien.ac.at/plugins/irfanview_plugins_399.exe</location> + </application> + <application name="TuxPaint"> + <regname>Tux Paint 0.9.16</regname> + <version>0.9.16</version> + <description>An open source bitmap graphics editor geared towards young children.</description> + <location>http://ovh.dl.sourceforge.net/sourceforge/tuxpaint/tuxpaint-0.9.16-win32-ins...</location> + </application> + </category> + <category name="Multimedia" icon="4"> + </category> + <category name="Development" icon="5"> + <application name="ReactOS Build Environment"> + <regname>ReactOS Build Environment 0.3.4</regname> + <version>0.3.4</version> + <description>Allows you to build the ReactOS Source. For more instructions see ReactOS wiki.</description> + <location>http://ovh.dl.sourceforge.net/sourceforge/reactos/RosBE-0.3.4.exe</location> + </application> + <application name="MinGW"> + <regname>MinGW 5.1.3</regname> + <version>5.1.3</version> + <description>A Port of the GNU toolchain with GCC, GDB, GNU make, etc.</description> + <location>http://puzzle.dl.sourceforge.net/sourceforge/mingw/MinGW-5.1.3.exe</location> + </application> + <application name="FreeBASIC"> + <regname>FreeBASIC 0.16b</regname> + <version>0.16b</version> + <description>Open Source Basic Compiler. The Basic syntax is compatible to QBASIC.</description> + <location>http://switch.dl.sourceforge.net/sourceforge/fbc/FreeBASIC-v0.16b-win32.exe</location> + </application> + </category> + <category name="Games & Fun" icon="6"> + <application name="ScummVM"> + <regname>ScummVM 0.9.1</regname> + <version>0.9.1</version> + <description>SamNMax, Day of Tentacle, etc on ReactOS</description> + <location>http://ovh.dl.sourceforge.net/sourceforge/scummvm/scummvm-0.9.1-win32.exe</location> + </application> + <application name="Tile World"> + <description>Nice Clone of Chip's Challenge originally made for the Atari Lynx. Includes free CCLP2 Graphics Pack, so you dont need the copyrighted Original.</description> + <location>http://www.muppetlabs.com/~breadbox/pub/software/tworld/tworld-1.3.0-win32-C...</location> + </application> + <application name="OpenTTD"> + <regname>OpenTTD 0.5.0</regname> + <version>0.5.0-RC5</version> + <description>Open-source-clone of the "Transport Tycoon Deluxe" game-engine. You need a copy of Transport Tycoon.</description> + <location>http://ovh.dl.sourceforge.net/sourceforge/openttd/openttd-0.5.0-RC5-win32.ex...</location> + </application> + <application name="LBreakout2">LBreakout2 2.4.1 + <regname>LBreakout2 2.4.1</regname> + <version>2.4.1</version> + <description>Breakout Clone using SDL libs.</description> + <location>http://switch.dl.sourceforge.net/sourceforge/lgames/lbreakout2-2.4.1-win32.e...</location> + </application> + <application name="LGeneral"> + <regname>LGeneral 1.1</regname> + <version>1.1</version> + <description>Panzer General Clone using SDL libs.</description> + <location>http://kent.dl.sourceforge.net/sourceforge/lgames/lgeneral-1.1-win32.exe</location> + </application> + <application name="LMarbles"> + <regname>LMarbles 1.0.6</regname> + <version>1.0.6</version> + <description>Atomix Clone using SDL libs.</description> + <location>http://heanet.dl.sourceforge.net/sourceforge/lgames/lmarbles-1.0.6-win32.exe</location> + </application> + </category> + <category name="Tools" icon="7"> + <application name="7-Zip"> + <regname>7-Zip 4.42</regname> + <version>4.42</version> + <description>Utility to create and open 7zip, zip, tar, rar and other archive files.</description> + <location>http://ovh.dl.sourceforge.net/sourceforge/sevenzip/7z442.exe</location> + </application> + <application name="uTorrent"> + <regname>uTorrent</regname> + <version>1.6</version> + <description>Small and fast Torrent Client.</description> + <location>http://download.utorrent.com/1.6/uTorrent-1.6-install.exe</location> + </application> + <application name="Audio Grabber"> + <regname>Audiograbber 1.83 SE </regname> + <version>1.83 SE</version> + <description>A very good CD Ripper/Audio File Converter.</description> + <location>http://www.audiograbber.de/files/342677432/agsetup183se.exe</location> + </application> + </category> + <category name="Others" icon="8"> + <application name="Simple Direct Media Layer (SDL) Runtime"> + <regname>SDL Runtime</regname> + <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> + <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 name="DOSBox"> + <version>0.65</version> + <description>DOSBox is a DOS emulator.</description> + <location>http://puzzle.dl.sourceforge.net/sourceforge/dosbox/DOSBox0.65-win32-install...</location> + </application> + </category> +</tree>
Modified: trunk/reactos/base/applications/downloader/resources.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/downloade... ============================================================================== --- trunk/reactos/base/applications/downloader/resources.h (original) +++ trunk/reactos/base/applications/downloader/resources.h Fri Mar 2 20:27:39 2007 @@ -39,9 +39,10 @@ #define IDS_XMLERROR_1 14 #define IDS_XMLERROR_2 15 #define IDS_DOWNLOAD_ERROR 16 -#define IDS_VERSION 17 -#define IDS_LICENCE 18 -#define IDS_MAINTAINER 19 +#define IDS_UNZIP_ERROR 17 +#define IDS_VERSION 18 +#define IDS_LICENCE 19 +#define IDS_MAINTAINER 20
-#define STRING_COUNT 20 +#define STRING_COUNT 21 #define MAX_STRING_LENGHT 0x100
Added: trunk/reactos/base/applications/downloader/script.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/downloade... ============================================================================== --- trunk/reactos/base/applications/downloader/script.c (added) +++ trunk/reactos/base/applications/downloader/script.c Fri Mar 2 20:27:39 2007 @@ -1,0 +1,246 @@ +/* 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; +} +
Propchange: trunk/reactos/base/applications/downloader/script.c ------------------------------------------------------------------------------ svn:eol-style = native
Propchange: trunk/reactos/base/applications/downloader/script.c ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision
Modified: trunk/reactos/base/applications/downloader/structures.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/downloade... ============================================================================== --- trunk/reactos/base/applications/downloader/structures.h (original) +++ trunk/reactos/base/applications/downloader/structures.h Fri Mar 2 20:27:39 2007 @@ -9,6 +9,8 @@ WCHAR Description[0x400]; WCHAR Location[0x100]; struct Application* Next; + struct ScriptElement* InstallScript; + struct ScriptElement* UninstallScript; };
struct Category @@ -22,3 +24,17 @@ struct Category* Children; struct Category* Parent; }; + +struct ScriptElement +{ + WCHAR Func[0x100]; + WCHAR Arg[2][0x100]; + struct ScriptElement* Next; +}; + +struct lParamDownload +{ + HWND Dlg; + WCHAR* URL; + WCHAR* File; +};
Modified: trunk/reactos/base/applications/downloader/translations/de.rc URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/downloade... ============================================================================== --- trunk/reactos/base/applications/downloader/translations/de.rc (original) +++ trunk/reactos/base/applications/downloader/translations/de.rc Fri Mar 2 20:27:39 2007 @@ -14,7 +14,7 @@ BEGIN IDS_WINDOW_TITLE "Download ! - ReactOS Downloader" IDS_WELCOME_TITLE "Willkommen im ReactOS Downloader" - IDS_WELCOME "Bitte wählen Sie rechts eine Kategorie. Dies ist Version 1.0." + IDS_WELCOME "Bitte wählen Sie links eine Kategorie. Dies ist Version 1.0." 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_UPDATE_TITLE "Update" @@ -29,6 +29,7 @@ IDS_XMLERROR_1 "XML Datei nicht gefunden!" 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_UNZIP_ERROR "7-Zip nicht gefunden.\nBitte installieren Sie 7-Zip." IDS_VERSION "Version: " IDS_LICENCE "Lizenz: " IDS_MAINTAINER "Maintainer: "
Modified: trunk/reactos/base/applications/downloader/translations/en.rc URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/downloade... ============================================================================== --- trunk/reactos/base/applications/downloader/translations/en.rc (original) +++ trunk/reactos/base/applications/downloader/translations/en.rc Fri Mar 2 20:27:39 2007 @@ -14,7 +14,7 @@ BEGIN IDS_WINDOW_TITLE "Download ! - ReactOS Downloader" IDS_WELCOME_TITLE "Welcome to the ReactOS Downloader" - IDS_WELCOME "Please choose a category on the right. This is version 1.0." + IDS_WELCOME "Please choose a category on the left. This is version 1.0." 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_UPDATE_TITLE "Update" @@ -29,6 +29,7 @@ IDS_XMLERROR_1 "Could not find 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_UNZIP_ERROR "7-Zip not found.\nPlease install 7-Zip" IDS_VERSION "Version: " IDS_LICENCE "Licence: " IDS_MAINTAINER "Maintainer: "
Modified: trunk/reactos/base/applications/downloader/translations/fr.rc URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/downloade... ============================================================================== --- trunk/reactos/base/applications/downloader/translations/fr.rc (original) +++ trunk/reactos/base/applications/downloader/translations/fr.rc Fri Mar 2 20:27:39 2007 @@ -29,6 +29,7 @@ IDS_XMLERROR_1 "Impossible de trouver 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_UNZIP_ERROR "7-Zip not found.\nPlease install 7-Zip" IDS_VERSION "Version: " IDS_LICENCE "Licence: " IDS_MAINTAINER "Maintainer: "
Modified: trunk/reactos/base/applications/downloader/translations/id.rc URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/downloade... ============================================================================== --- trunk/reactos/base/applications/downloader/translations/id.rc (original) +++ trunk/reactos/base/applications/downloader/translations/id.rc Fri Mar 2 20:27:39 2007 @@ -29,6 +29,7 @@ IDS_XMLERROR_1 "Tidak dapat menemukan file xml !" IDS_XMLERROR_2 "Tidak dapat mengurai file xml !" 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_LICENCE "Lisensi: " IDS_MAINTAINER "Pemelihara: "
Modified: trunk/reactos/base/applications/downloader/translations/it.rc URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/downloade... ============================================================================== --- trunk/reactos/base/applications/downloader/translations/it.rc (original) +++ trunk/reactos/base/applications/downloader/translations/it.rc Fri Mar 2 20:27:39 2007 @@ -29,6 +29,7 @@ IDS_XMLERROR_1 "File xml non trovato !" IDS_XMLERROR_2 "Impossibile trattare il contenuto del file xml !" 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_LICENCE "Licence: " IDS_MAINTAINER "Maintainer: "
Modified: trunk/reactos/base/applications/downloader/xml.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/downloade... ============================================================================== --- trunk/reactos/base/applications/downloader/xml.c (original) +++ trunk/reactos/base/applications/downloader/xml.c Fri Mar 2 20:27:39 2007 @@ -10,20 +10,153 @@ #include <stdio.h> #include <windows.h> #include <shlwapi.h> +#include <io.h> #include "structures.h" #include "resources.h"
BOOL TagOpen; +BOOL InstallScriptOpen; +BOOL UninstallScriptOpen; struct Category* Current; struct Application* CurrentApplication; +struct ScriptElement* CurrentScript; +char DML_Name[0x100]; +char DML_Target[0x100]; +char Path [0x100]; char CurrentTag [0x100]; + 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) { int i;
- if(!strcmp(tag, "tree") && !CurrentApplication) + if(!strcmp(tag, "import")) + { + 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 } @@ -92,7 +225,16 @@ } else if (CurrentApplication) { - strncpy(CurrentTag, tag, 0x100); + if (!strcmp(tag, "installscript")) { + InstallScriptOpen = TRUE; + } else if (!strcmp(tag, "uninstallscript")) { + UninstallScriptOpen = TRUE; + } else { + Script_tag_opened(usrdata, tag, arg); + if (CurrentScript == NULL) { + strncpy(CurrentTag, tag, 0x100); + } + } } else MessageBoxW(0,Strings[IDS_XMLERROR_2],0,0); @@ -155,30 +297,27 @@ { CurrentApplication = NULL; } -} - -BOOL ProcessXML (const char* filename, struct Category* Root) + else if(!strcmp(tag, "installscript") || !strcmp(tag, "uninstallscript")) + { + CurrentScript = NULL; + InstallScriptOpen = FALSE; + UninstallScriptOpen = FALSE; + } +} + +BOOL ImportXML (const char* filename) { int done = 0; - char buffer[255]; + char buffer[0x100]; FILE* file; XML_Parser parser; - - if(Current) + strcpy(buffer, Path); + strncat(buffer, filename, 0x100-strlen(buffer)); + file = fopen(buffer, "r"); + if(!file) + { + MessageBoxW(0,Strings[IDS_XMLERROR_1],0,0); return FALSE; - - Current = Root; - TagOpen = TRUE; - - file = fopen(filename, "r"); - if(!file) - { - file = fopen("downloader.xml", "r"); - if(!file) - { - MessageBoxW(0,Strings[IDS_XMLERROR_1],0,0); - return FALSE; - } }
parser = XML_ParserCreate(NULL); @@ -204,10 +343,169 @@ 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) { if (Apps->Next) FreeApps(Apps->Next); + if (Apps->InstallScript) + FreeScript(Apps->InstallScript); + if (Apps->UninstallScript) + FreeScript(Apps->UninstallScript);
free(Apps); }