- changed name of package library to package.dll

- fixed PML_TransError function (possibly fixes bug 730)

svn path=/trunk/; revision=19570
This commit is contained in:
Sebastian Gasiorek 2005-11-25 21:25:42 +00:00
parent 7a8e31d41b
commit 48fa464e43
10 changed files with 49 additions and 45 deletions

View 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>

View 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>

View 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;

View 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>

View file

@ -21,4 +21,4 @@ END
123 RCDATA "options.xml"
/* EOF */
/* EOF */

View 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;
}

View 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)
{

View 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);

View 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);

View 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">
<importlibrary definition="package.def" />
<include base="package">.</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>