- changed name of package library to package.dll
authorSebastian Gasiorek <sebastian.gasiorek@reactos.org>
Fri, 25 Nov 2005 21:25:42 +0000 (21:25 +0000)
committerSebastian Gasiorek <sebastian.gasiorek@reactos.org>
Fri, 25 Nov 2005 21:25:42 +0000 (21:25 +0000)
- fixed PML_TransError function (possibly fixes bug 730)

svn path=/trunk/; revision=19570

rosapps/packmgr/cmd-line/rosget.xml
rosapps/packmgr/directory.xml
rosapps/packmgr/gui/main.c
rosapps/packmgr/gui/packmgr.xml
rosapps/packmgr/lib/es.rc
rosapps/packmgr/lib/main.cpp
rosapps/packmgr/lib/package.cpp
rosapps/packmgr/lib/package.h
rosapps/packmgr/lib/package.hpp
rosapps/packmgr/lib/package.xml [moved from rosapps/packmgr/lib/packlib.xml with 82% similarity]

index 00945f6..d9fab33 100644 (file)
@@ -1,12 +1,12 @@
 <module name="rosget" type="win32cui" installbase="system32" installname="rosget.exe">
-       <include base="packlib">.</include>
+       <include base="package">.</include>
        <define name="__USE_W32API" />
        <define name="UNICODE" />
        <define name="_WIN32_IE">0x0501</define>
        <define name="_WIN32_WINNT">0x0501</define>
 
        <library>kernel32</library>
-       <library>packlib</library>
+       <library>package</library>
        <file>main.c</file>
        <file>ros-get.rc</file>
 </module>
index 91da3fe..543fba3 100644 (file)
@@ -5,5 +5,5 @@
        <xi:include href="gui/packmgr.xml" />
 </directory>
 <directory name="lib">
-       <xi:include href="lib/packlib.xml" />
+       <xi:include href="lib/package.xml" />
 </directory>
\ No newline at end of file
index d798828..a7d90ca 100644 (file)
@@ -40,6 +40,7 @@ int WINAPI WinMain (HINSTANCE hinst, HINSTANCE hPrevInstance, PSTR szCmdLine, in
        HWND       hwnd;
        MSG        msg;
        WNDCLASSEX wc = {0};
+       WCHAR errbuf[2000];
 
        // Window creation
        wc.cbSize        = sizeof(WNDCLASSEX); 
@@ -78,7 +79,7 @@ int WINAPI WinMain (HINSTANCE hinst, HINSTANCE hPrevInstance, PSTR szCmdLine, in
        
        if(error)
        {
-               MessageBox(0,PML_TransError(error),0,0);
+               MessageBox(0,PML_TransError(error, (WCHAR*)errbuf, sizeof(errbuf)/sizeof(WCHAR)),0,0);
                return 0;
        }
        
@@ -154,12 +155,13 @@ void InitControls (HWND hwnd)
 {
 
        HINSTANCE hinst = GetModuleHandle(NULL);
+       WCHAR errbuf[2000];
 
        // Create the controls
        hTree = CreateWindowEx(0, WC_TREEVIEW, L"TreeView", WS_CHILD|WS_VISIBLE|WS_BORDER|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS, 
                                                        0, 0, 0, 0, hwnd, NULL, hinst, NULL);
 
-       hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, L"edit", PML_TransError(IDS_LOAD), WS_CHILD|WS_VISIBLE|ES_MULTILINE, 
+       hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, L"edit", PML_TransError(IDS_LOAD, (WCHAR*)errbuf, sizeof(errbuf)/sizeof(WCHAR)), WS_CHILD|WS_VISIBLE|ES_MULTILINE, 
                                                        0, 0, 100, 100, hwnd, NULL, hinst, NULL);
        
        hPopup = LoadMenu(hinst, MAKEINTRESOURCE(IDR_POPUP));
@@ -388,6 +390,8 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 // Warning: This function is called from another thread
 int SetStatus (int status1, int status2, WCHAR* text)
 {
+       WCHAR errbuf[2000];
+
        // Set the Rage to 1000
        SendMessage(GetDlgItem(hStatus, IDC_STATUS1), PBM_SETRANGE32, 0, 1000);
        SendMessage(GetDlgItem(hStatus, IDC_STATUS2), PBM_SETRANGE32, 0, 1000);
@@ -406,7 +410,7 @@ int SetStatus (int status1, int status2, WCHAR* text)
        if(status1==1000)
        {
                EndDialog(hStatus, TRUE);
-               MessageBox(0,PML_TransError(status2),0,0);
+               MessageBox(0,PML_TransError(status2, (WCHAR*)errbuf, sizeof(errbuf)/sizeof(WCHAR)),0,0);
        }
 
        return 0;
index cf6f9a4..50d5127 100644 (file)
@@ -1,5 +1,5 @@
 <module name="packmgr" type="win32gui" installbase="system32" installname="packmgr.exe">
-       <include base="packlib">.</include>
+       <include base="package">.</include>
        <include base="packmgr">.</include>
        <define name="__USE_W32API" />
        <define name="UNICODE" />
@@ -9,7 +9,7 @@
        <library>kernel32</library>
        <library>user32</library>
        <library>comctl32</library>
-       <library>packlib</library>
+       <library>package</library>
 
        <file>main.c</file>
        <file>packmgr.rc</file>
index e2f0bd0..109ac13 100644 (file)
@@ -21,4 +21,4 @@ END
 \r
 123               RCDATA       "options.xml"\r
 \r
-/* EOF */
\ No newline at end of file
+/* EOF */\r
index db4d1da..5d18cf6 100644 (file)
@@ -119,7 +119,9 @@ extern "C" int PML_DoIt (TREE* tree, PML_SetStatus SetStatus, PML_Ask Ask)
 
        //ask
        WCHAR buffer [2000];
-       wsprintf(buffer, PML_TransError(ERR_READY), tree->todo.size());
+       WCHAR errbuf [2000];
+
+       wsprintf(buffer, PML_TransError(ERR_READY, (WCHAR*)errbuf, sizeof(errbuf)/sizeof(WCHAR)), tree->todo.size());
 
        if(!Ask(buffer))
                return ERR_GENERIC;
@@ -136,13 +138,11 @@ extern "C" int PML_DoIt (TREE* tree, PML_SetStatus SetStatus, PML_Ask Ask)
 }
 
 // Translates Errorcode into human language
-extern "C" WCHAR* PML_TransError (int code)
+extern "C" WCHAR* PML_TransError (int code, WCHAR *string, INT maxchar)
 {
-       // I know we, got a memory leak here
-       static WCHAR string [256];
 
-    if(!LoadString(GetModuleHandle(L"package"), code, string, 256))
-               return PML_TransError(ERR_GENERIC);
+       if(!LoadString(GetModuleHandle(L"package"), code, string, maxchar))
+               return PML_TransError(ERR_GENERIC, string, maxchar);
 
        return string;
 }
index 1858145..857fbbd 100644 (file)
@@ -167,8 +167,8 @@ extern "C" int PML_SetAction (TREE* tree, int id, int action, PML_SetIcon SetIco
        if(pack->depencies.size() && action)
        {
                UINT count = pack->depencies.size();
-               WCHAR buffer[2000], buffer2[200];
-               wcscpy(buffer, PML_TransError(ERR_DEP1));
+               WCHAR buffer[2000], buffer2[200], errbuf[2000];
+               PML_TransError(ERR_DEP1, (WCHAR*)buffer, sizeof(buffer)/sizeof(WCHAR));
 
                for (i=0; i<pack->depencies.size(); i++)
                {
@@ -187,7 +187,7 @@ extern "C" int PML_SetAction (TREE* tree, int id, int action, PML_SetIcon SetIco
                        wsprintf(buffer, L"%s - %s\n", buffer, buffer2);//
                }
 
-               wcscat(buffer, PML_TransError(ERR_DEP2));
+               wcscat(buffer, PML_TransError(ERR_DEP2, (WCHAR*)errbuf, sizeof(errbuf)/sizeof(WCHAR)));
 
                if(count)
                {
index e33c63c..1956588 100644 (file)
@@ -28,7 +28,7 @@ typedef void* pTree;
 /* Prototypes */
 
 void PML_Abort (void);
-WCHAR* PML_TransError (int code);
+WCHAR* PML_TransError (int code, WCHAR* string, INT maxchar);
 
 int PML_LoadTree (pTree*, char* url, PML_AddItem);
 int PML_FindItem (pTree tree, const char* what);
index d29ae5a..020dfdc 100644 (file)
@@ -72,7 +72,7 @@ typedef struct
 extern "C" 
 {
   void PML_Abort (void);
-  WCHAR* PML_TransError (int code);
+  WCHAR* PML_TransError (int code, WCHAR* string, INT maxchar);
 
   int PML_LoadTree (pTree*, char* url, PML_AddItem);
   int PML_FindItem (TREE* tree, const char* what);
similarity index 82%
rename from rosapps/packmgr/lib/packlib.xml
rename to rosapps/packmgr/lib/package.xml
index 67b5a87..7ee0678 100644 (file)
@@ -1,25 +1,25 @@
-<module name="packlib" type="win32dll" installbase="system32" installname="package.dll">
-       <importlibrary definition="package.def" />
-       <include base="packlib">.</include>
-
-       <define name="UNICODE" />
-       <define name="__USE_W32API" />
-       <define name="_WIN32_IE">0x0501</define>
-       <define name="_WIN32_WINNT">0x0501</define>
-
-       <library>kernel32</library>
-       <library>gdi32</library>
-       <library>user32</library>
-       <library>expat</library>
-       <library>urlmon</library>
-
-       <file>download.cpp</file>
-       <file>functions.cpp</file>
-       <file>log.cpp</file>
-       <file>main.cpp</file>
-       <file>options.cpp</file>
-       <file>package.cpp</file>
-       <file>script.cpp</file>
-       <file>tree.cpp</file>
-       <file>package.rc</file>
-</module>
+<module name="package" type="win32dll" installbase="system32" installname="package.dll">\r
+       <importlibrary definition="package.def" />\r
+       <include base="package">.</include>\r
+\r
+       <define name="UNICODE" />\r
+       <define name="__USE_W32API" />\r
+       <define name="_WIN32_IE">0x0501</define>\r
+       <define name="_WIN32_WINNT">0x0501</define>\r
+\r
+       <library>kernel32</library>\r
+       <library>gdi32</library>\r
+       <library>user32</library>\r
+       <library>expat</library>\r
+       <library>urlmon</library>\r
+\r
+       <file>download.cpp</file>\r
+       <file>functions.cpp</file>\r
+       <file>log.cpp</file>\r
+       <file>main.cpp</file>\r
+       <file>options.cpp</file>\r
+       <file>package.cpp</file>\r
+       <file>script.cpp</file>\r
+       <file>tree.cpp</file>\r
+       <file>package.rc</file>\r
+</module>\r