Author: tkreuzer
Date: Wed Jan 12 15:31:20 2011
New Revision: 50372
URL:
http://svn.reactos.org/svn/reactos?rev=50372&view=rev
Log:
[PING]
Implement small helper MyLoadString, using FindResource, LoadResource, LockResource and
replacing LoadString, so we don't need to link to user32 anymore.
Modified:
trunk/reactos/base/applications/network/ping/ping.c
trunk/reactos/base/applications/network/ping/ping.rbuild
Modified: trunk/reactos/base/applications/network/ping/ping.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/ping/ping.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/ping/ping.c [iso-8859-1] Wed Jan 12 15:31:20
2011
@@ -109,6 +109,24 @@
}
#endif /* !NDEBUG */
+LPWSTR
+MyLoadString(UINT uID)
+{
+ HRSRC hres;
+ HGLOBAL hResData;
+ LPWSTR pwsz;
+
+ hres = FindResourceW(NULL, MAKEINTRESOURCEW((LOWORD(uID) >> 4) + 1),
RT_STRING);
+ if (!hres) return NULL;
+
+ hResData = LoadResource(NULL, hres);
+ if (!hResData) return NULL;
+
+ pwsz = LockResource(hResData);
+ if (!pwsz) return NULL;
+ return pwsz + 1;
+}
+
void FormatOutput(UINT uID, ...)
{
va_list valist;
@@ -121,8 +139,8 @@
va_start(valist, uID);
- if(!LoadString(NULL, uID, (LPWSTR)&Format, 0))
- return;
+ Format = MyLoadString(uID);
+ if (!Format) return;
DataLength = FormatMessage(FORMAT_MESSAGE_FROM_STRING, Format, 0, 0, Buf,\
sizeof(Buf) / sizeof(WCHAR), &valist);
@@ -459,7 +477,7 @@
_i64tow(LargeTime.QuadPart, Convstr, 10);
wcscpy(String, Convstr);
- LoadString(NULL, IDS_MS, (LPWSTR)&ms, 0);
+ ms = MyLoadString(IDS_MS);
wcscat(String, ms);
}
@@ -523,7 +541,7 @@
LPWSTR ms1;
wcscpy(Sign, L"<");
- LoadString(NULL, IDS_1MS, (LPWSTR)&ms1, 0);
+ ms1 = MyLoadString(IDS_1MS);
wcscpy(Time, ms1);
}
else
Modified: trunk/reactos/base/applications/network/ping/ping.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/ping/ping.rbuild [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/ping/ping.rbuild [iso-8859-1] Wed Jan 12
15:31:20 2011
@@ -4,7 +4,6 @@
<include base="ping">.</include>
<define name="__USE_W32_SOCKETS" />
<library>ws2_32</library>
- <library>user32</library>
<file>ping.c</file>
<file>ping.rc</file>
</module>