[1/2] winefile: Fully convert to unicode
André Hentschel
nerv at dawncrow.de
Mon Feb 20 13:50:07 CST 2012
---
programs/winefile/Makefile.in | 2 +-
programs/winefile/winefile.c | 37 +++++++++++--------------------------
programs/winefile/winefile.h | 4 ----
3 files changed, 12 insertions(+), 31 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 52e1bc4..a8f6541 100644
--- a/programs/winefile/winefile.c
+++ b/programs/winefile/winefile.c
@@ -1834,6 +1834,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) {
@@ -1846,13 +1847,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",
+ 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);
}
}
@@ -4732,13 +4733,18 @@ static int find_window_class(LPCWSTR classname)
#endif
-static int winefile_main(HINSTANCE hinstance, int cmdshow, LPCWSTR path)
+int APIENTRY wWinMain(HINSTANCE hinstance, HINSTANCE previnstance, LPWSTR cmdline, int cmdshow)
{
+#ifdef _NO_EXTENSIONS
+ if (find_window_class(sWINEFILEFRAME))
+ return 1;
+#endif
+
MSG msg;
InitInstance(hinstance);
- if( !show_frame(0, cmdshow, path) )
+ if( !show_frame(0, cmdshow, cmdline) )
{
ExitInstance();
return 1;
@@ -4759,24 +4765,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
-{
-#ifdef _NO_EXTENSIONS
- if (find_window_class(sWINEFILEFRAME))
- return 1;
-#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 82a3161..10d32e7 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
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Nachrichtenteil als Anhang
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20120220/2d171512/attachment.ksh>
More information about the wine-patches
mailing list