[3/3] winefile: Fully convert to unicode (try 3)

André Hentschel nerv at dawncrow.de
Sun Mar 18 13:24:28 CDT 2012


---
 programs/winefile/Makefile.in |    2 +-
 programs/winefile/winefile.c  |   31 ++++++++-----------------------
 programs/winefile/winefile.h  |    4 ----
 3 files changed, 9 insertions(+), 28 deletions(-)

diff --git a/programs/winefile/Makefile.in b/programs/winefile/Makefile.in
index da1818e..efd2bf3 100644
--- a/programs/winefile/Makefile.in
+++ b/programs/winefile/Makefile.in
@@ -1,6 +1,6 @@
 EXTRADEFS = -D__WINE__
 MODULE    = winefile.exe
-APPMODE   = -mwindows
+APPMODE   = -mwindows -municode
 IMPORTS   = uuid shell32 comdlg32 comctl32 ole32 mpr version user32 gdi32 advapi32
 
 C_SRCS = \
diff --git a/programs/winefile/winefile.c b/programs/winefile/winefile.c
index 6f5d18b..582b753 100644
--- a/programs/winefile/winefile.c
+++ b/programs/winefile/winefile.c
@@ -1761,6 +1761,7 @@ static void CheckForFileInfo(struct PropertiesDialog* dlg, HWND hwnd, LPCWSTR st
 	static WCHAR sTranslation[] = {'\\','V','a','r','F','i','l','e','I','n','f','o','\\','T','r','a','n','s','l','a','t','i','o','n','\0'};
 	static WCHAR sStringFileInfo[] = {'\\','S','t','r','i','n','g','F','i','l','e','I','n','f','o','\\',
 										'%','0','4','x','%','0','4','x','\\','%','s','\0'};
+        static WCHAR sFmt[] = {'%','d','.','%','d','.','%','d','.','%','d','\0'};
 	DWORD dwVersionDataLen = GetFileVersionInfoSizeW(strFilename, NULL);
 
 	if (dwVersionDataLen) {
@@ -1773,13 +1774,13 @@ static void CheckForFileInfo(struct PropertiesDialog* dlg, HWND hwnd, LPCWSTR st
 			if (VerQueryValueW(dlg->pVersionData, sBackSlash, &pVal, &nValLen)) {
 				if (nValLen == sizeof(VS_FIXEDFILEINFO)) {
 					VS_FIXEDFILEINFO* pFixedFileInfo = (VS_FIXEDFILEINFO*)pVal;
-					char buffer[BUFFER_LEN];
+                                        WCHAR buffer[BUFFER_LEN];
 
-					sprintf(buffer, "%d.%d.%d.%d",
-						HIWORD(pFixedFileInfo->dwFileVersionMS), LOWORD(pFixedFileInfo->dwFileVersionMS),
-						HIWORD(pFixedFileInfo->dwFileVersionLS), LOWORD(pFixedFileInfo->dwFileVersionLS));
+                                        sprintfW(buffer, sFmt,
+                                                 HIWORD(pFixedFileInfo->dwFileVersionMS), LOWORD(pFixedFileInfo->dwFileVersionMS),
+                                                 HIWORD(pFixedFileInfo->dwFileVersionLS), LOWORD(pFixedFileInfo->dwFileVersionLS));
 
-					SetDlgItemTextA(hwnd, IDC_STATIC_PROP_VERSION, buffer);
+                                        SetDlgItemTextW(hwnd, IDC_STATIC_PROP_VERSION, buffer);
 				}
 			}
 
@@ -4377,13 +4378,13 @@ static void ExitInstance(void)
 	ImageList_Destroy(Globals.himl);
 }
 
-static int winefile_main(HINSTANCE hinstance, int cmdshow, LPCWSTR path)
+int APIENTRY wWinMain(HINSTANCE hinstance, HINSTANCE previnstance, LPWSTR cmdline, int cmdshow)
 {
 	MSG msg;
 
 	InitInstance(hinstance);
 
-	if( !show_frame(0, cmdshow, path) )
+        if( !show_frame(0, cmdshow, cmdline) )
 	{
 		ExitInstance();
 		return 1;
@@ -4404,19 +4405,3 @@ static int winefile_main(HINSTANCE hinstance, int cmdshow, LPCWSTR path)
 
 	return msg.wParam;
 }
-
-
-#if defined(_MSC_VER)
-int APIENTRY wWinMain(HINSTANCE hinstance, HINSTANCE previnstance, LPWSTR cmdline, int cmdshow)
-#else
-int APIENTRY WinMain(HINSTANCE hinstance, HINSTANCE previnstance, LPSTR cmdline, int cmdshow)
-#endif
-{
-	{ /* convert ANSI cmdline into WCS path string */
-	WCHAR buffer[MAX_PATH];
-	MultiByteToWideChar(CP_ACP, 0, cmdline, -1, buffer, MAX_PATH);
-	winefile_main(hinstance, cmdshow, buffer);
-	}
-
-	return 0;
-}
diff --git a/programs/winefile/winefile.h b/programs/winefile/winefile.h
index 04aeb57..60b4aa1 100644
--- a/programs/winefile/winefile.h
+++ b/programs/winefile/winefile.h
@@ -30,16 +30,12 @@
 
 #define NONAMELESSUNION
 #include <windows.h>
-#include <commctrl.h>
 #include <commdlg.h>
 
 #ifdef UNICODE
 #define _UNICODE
 #endif
 
-#include <stdlib.h>
-#include <stdio.h>
-#include <ctype.h>
 #include <locale.h>
 #include <time.h>
 
-- 

Best Regards, André Hentschel


More information about the wine-patches mailing list