Author: mbosma
Date: Wed May 16 22:05:03 2007
New Revision: 26807
URL:
http://svn.reactos.org/svn/reactos?rev=26807&view=rev
Log:
Revert r25952 for now.
Added:
trunk/rosapps/downloader/downloader.xml
- copied unchanged from r25951,
trunk/reactos/base/applications/downloader/downloader.xml
Removed:
trunk/rosapps/downloader/packagetree/
trunk/rosapps/downloader/script.c
Modified:
trunk/rosapps/downloader/download.c
trunk/rosapps/downloader/downloader.rbuild
trunk/rosapps/downloader/main.c
trunk/rosapps/downloader/resources.h
trunk/rosapps/downloader/structures.h
trunk/rosapps/downloader/translations/de.rc
trunk/rosapps/downloader/translations/en.rc
trunk/rosapps/downloader/translations/fr.rc
trunk/rosapps/downloader/translations/id.rc
trunk/rosapps/downloader/translations/it.rc
trunk/rosapps/downloader/xml.c
Modified: trunk/rosapps/downloader/download.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/downloader/download.c?rev=…
==============================================================================
--- trunk/rosapps/downloader/download.c (original)
+++ trunk/rosapps/downloader/download.c Wed May 16 22:05:03 2007
@@ -221,11 +221,31 @@
{
//static const WCHAR szUrl[] = DownloadUrl;
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;
BOOL bCancelled = FALSE;
- dl = CreateDl(Dlg, &bCancelled);
- r = URLDownloadToFileW(NULL, ((struct lParamDownload*)Context)->URL, ((struct
lParamDownload*)Context)->File, 0, dl);
+ 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);
if (NULL != dl)
{
IBindStatusCallback_Release(dl);
@@ -233,6 +253,30 @@
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;
@@ -243,7 +287,7 @@
{
HANDLE Thread;
DWORD ThreadId;
- HWND Item;;
+ HWND Item;
switch (Msg)
{
@@ -276,8 +320,7 @@
ShowWindow(Item, SW_HIDE);
}
}*/
- ((struct lParamDownload*)lParam)->Dlg = Dlg;
- Thread = CreateThread(NULL, 0, ThreadFunc, (LPVOID)lParam, 0, &ThreadId);
+ Thread = CreateThread(NULL, 0, ThreadFunc, Dlg, 0, &ThreadId);
if (NULL == Thread)
{
return FALSE;
Modified: trunk/rosapps/downloader/downloader.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/downloader/downloader.rbui…
==============================================================================
--- trunk/rosapps/downloader/downloader.rbuild (original)
+++ trunk/rosapps/downloader/downloader.rbuild Wed May 16 22:05:03 2007
@@ -1,8 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
-<directory name="packagetree">
- <xi:include href="packagetree/packagetree.rbuild" />
-</directory>
+<installfile base="system32">downloader.xml</installfile>
<module name="downloader" type="win32gui"
installbase="system32" installname="downloader.exe">
<include base="downloader">.</include>
<include base="expat">.</include>
@@ -29,6 +27,5 @@
<file>main.c</file>
<file>xml.c</file>
<file>download.c</file>
- <file>script.c</file>
<file>downloader.rc</file>
</module>
Modified: trunk/rosapps/downloader/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/downloader/main.c?rev=2680…
==============================================================================
--- trunk/rosapps/downloader/main.c (original)
+++ trunk/rosapps/downloader/main.c Wed May 16 22:05:03 2007
@@ -10,65 +10,46 @@
#include <richedit.h>
#include <stdio.h>
#include <shlwapi.h>
-#include <wchar.h>
#include "resources.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;
HBITMAP hLogo, hUnderline;
-CHAR* CmdLine;
WCHAR* DescriptionHeadline = L"";
WCHAR* DescriptionText = L"";
-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
+WCHAR ApplicationText[700];
+
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(struct Application* CurrentApplication, WCHAR* Uninstaller) {
-
- DWORD ArraySize = 0x100;
+
+BOOL getUninstaller(WCHAR* RegName, WCHAR* Uninstaller) {
+
+ const DWORD ArraySize = 200;
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 = sizeof(Value);
+ Size = ArraySize;
if
(RegQueryValueExW(hKey2,L"DisplayName",0,&Type,(LPBYTE)Value,&Size) ==
ERROR_SUCCESS) {
Size = ArraySize;
- if (!wcscmp(Value,CurrentApplication->RegName)) {
+ if (StrCmpW(Value,RegName) == 0) {
if
(RegQueryValueExW(hKey2,L"UninstallString",0,&Type,(LPBYTE)Uninstaller,&Size)
== ERROR_SUCCESS) {
RegCloseKey(hKey2);
RegCloseKey(hKey1);
@@ -142,16 +123,17 @@
CurrentApplication = Category->Apps;
+ WCHAR Uninstaller[200];
while(CurrentApplication)
{
Insert.item.lParam = (UINT)CurrentApplication;
Insert.item.pszText = CurrentApplication->Name;
Insert.item.cchTextMax = lstrlenW(CurrentApplication->Name);
- if(getUninstaller(CurrentApplication, NULL)) {
- Insert.item.iImage = 9;
- } else {
- Insert.item.iImage = 10;
- }
+ Insert.item.iImage = 10;
+ if(StrCmpW(CurrentApplication->RegName,L"")) {
+ if(getUninstaller(CurrentApplication->RegName, Uninstaller))
+ Insert.item.iImage = 9;
+ }
SendMessage(hwnd, TVM_INSERTITEM, 0, (LPARAM)&Insert);
CurrentApplication = CurrentApplication->Next;
}
@@ -179,8 +161,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, 35, hwnd, 0, hInstance, NULL);
- hUninstallButton = CreateWindowW (L"Button", L"",
WS_CHILD|WS_VISIBLE|BS_BITMAP, 260, 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, 33, 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)));
@@ -285,41 +267,17 @@
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) {
- 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);
+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();
}
LRESULT CALLBACK WndProc (HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
@@ -330,34 +288,9 @@
{
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;
-
- 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();
- }
+ ShowMessage(Strings[IDS_WELCOME_TITLE], Strings[IDS_WELCOME]);
}
break;
@@ -386,20 +319,21 @@
{
if (lParam == (LPARAM)hDownloadButton)
{
- if(SelectedApplication) {
- DWORD ThreadId;
- CreateThread(NULL, 0, InstallThreadFunc, SelectedApplication, 0, &ThreadId);
- } else
+ if(SelectedApplication)
+ DialogBoxW(GetModuleHandle(NULL), MAKEINTRESOURCEW(IDD_DOWNLOAD), 0,
DownloadProc);
+ else
ShowMessage(Strings[IDS_NO_APP_TITLE], Strings[IDS_NO_APP]);
}
else if (lParam == (LPARAM)hUninstallButton)
{
- if(SelectedApplication) {
- DWORD ThreadId;
- CreateThread(NULL, 0, UninstallThreadFunc, SelectedApplication, 0, &ThreadId);
- hideUninstaller();
- } else
- ShowMessage(Strings[IDS_NO_APP_TITLE], Strings[IDS_NO_APP]);
+ if(SelectedApplication)
+ {
+ WCHAR Uninstaller[200];
+ if(StrCmpW(SelectedApplication->RegName, L"")) {
+ if(getUninstaller(SelectedApplication->RegName, Uninstaller))
+ startUninstaller(Uninstaller);
+ }
+ }
}
else if (lParam == (LPARAM)hUpdateButton)
{
@@ -429,9 +363,31 @@
SelectedApplication = (struct Application*)
((LPNMTREEVIEW)lParam)->itemNew.lParam;
if(SelectedApplication)
{
- ShowSelectedApplication();
- if(getUninstaller(SelectedApplication, NULL)) {
- bShowUninstaller = TRUE;
+ 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;
+ }
}
}
}
@@ -496,8 +452,7 @@
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.
Modified: trunk/rosapps/downloader/resources.h
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/downloader/resources.h?rev…
==============================================================================
--- trunk/rosapps/downloader/resources.h (original)
+++ trunk/rosapps/downloader/resources.h Wed May 16 22:05:03 2007
@@ -39,10 +39,9 @@
#define IDS_XMLERROR_1 14
#define IDS_XMLERROR_2 15
#define IDS_DOWNLOAD_ERROR 16
-#define IDS_UNZIP_ERROR 17
-#define IDS_VERSION 18
-#define IDS_LICENCE 19
-#define IDS_MAINTAINER 20
+#define IDS_VERSION 17
+#define IDS_LICENCE 18
+#define IDS_MAINTAINER 19
-#define STRING_COUNT 21
+#define STRING_COUNT 20
#define MAX_STRING_LENGHT 0x100
Removed: trunk/rosapps/downloader/script.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/downloader/script.c?rev=26…
==============================================================================
--- trunk/rosapps/downloader/script.c (original)
+++ trunk/rosapps/downloader/script.c (removed)
@@ -1,246 +1,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;
-}
-
Modified: trunk/rosapps/downloader/structures.h
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/downloader/structures.h?re…
==============================================================================
--- trunk/rosapps/downloader/structures.h (original)
+++ trunk/rosapps/downloader/structures.h Wed May 16 22:05:03 2007
@@ -9,8 +9,6 @@
WCHAR Description[0x400];
WCHAR Location[0x100];
struct Application* Next;
- struct ScriptElement* InstallScript;
- struct ScriptElement* UninstallScript;
};
struct Category
@@ -24,17 +22,3 @@
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/rosapps/downloader/translations/de.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/downloader/translations/de…
==============================================================================
--- trunk/rosapps/downloader/translations/de.rc (original)
+++ trunk/rosapps/downloader/translations/de.rc Wed May 16 22:05:03 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 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 "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,7 +29,6 @@
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/rosapps/downloader/translations/en.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/downloader/translations/en…
==============================================================================
--- trunk/rosapps/downloader/translations/en.rc (original)
+++ trunk/rosapps/downloader/translations/en.rc Wed May 16 22:05:03 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 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 "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,7 +29,6 @@
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/rosapps/downloader/translations/fr.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/downloader/translations/fr…
==============================================================================
--- trunk/rosapps/downloader/translations/fr.rc (original)
+++ trunk/rosapps/downloader/translations/fr.rc Wed May 16 22:05:03 2007
@@ -29,7 +29,6 @@
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/rosapps/downloader/translations/id.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/downloader/translations/id…
==============================================================================
--- trunk/rosapps/downloader/translations/id.rc (original)
+++ trunk/rosapps/downloader/translations/id.rc Wed May 16 22:05:03 2007
@@ -29,7 +29,6 @@
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/rosapps/downloader/translations/it.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/downloader/translations/it…
==============================================================================
--- trunk/rosapps/downloader/translations/it.rc (original)
+++ trunk/rosapps/downloader/translations/it.rc Wed May 16 22:05:03 2007
@@ -29,7 +29,6 @@
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/rosapps/downloader/xml.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/downloader/xml.c?rev=26807…
==============================================================================
--- trunk/rosapps/downloader/xml.c (original)
+++ trunk/rosapps/downloader/xml.c Wed May 16 22:05:03 2007
@@ -10,153 +10,20 @@
#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)
+
+void 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, "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)
+
+ if(!strcmp(tag, "tree") && !CurrentApplication)
{
// check version
}
@@ -225,16 +92,7 @@
}
else if (CurrentApplication)
{
- 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);
- }
- }
+ strncpy(CurrentTag, tag, 0x100);
}
else
MessageBoxW(0,Strings[IDS_XMLERROR_2],0,0);
@@ -297,27 +155,30 @@
{
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;
- char buffer[0x100];
+ char buffer[255];
FILE* file;
XML_Parser parser;
- strcpy(buffer, Path);
- strncat(buffer, filename, 0x100-strlen(buffer));
- file = fopen(buffer, "r");
+
+ if(Current)
+ return FALSE;
+
+ Current = Root;
+ TagOpen = TRUE;
+
+ file = fopen(filename, "r");
if(!file)
{
- MessageBoxW(0,Strings[IDS_XMLERROR_1],0,0);
- return FALSE;
+ file = fopen("downloader.xml", "r");
+ if(!file)
+ {
+ MessageBoxW(0,Strings[IDS_XMLERROR_1],0,0);
+ return FALSE;
+ }
}
parser = XML_ParserCreate(NULL);
@@ -343,169 +204,10 @@
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);
}