other-licenses/7zstub/src/Windows/ResourceString.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 // Windows/ResourceString.cpp
michael@0 2
michael@0 3 #include "StdAfx.h"
michael@0 4
michael@0 5 #include "Windows/ResourceString.h"
michael@0 6 #ifndef _UNICODE
michael@0 7 #include "Common/StringConvert.h"
michael@0 8 #endif
michael@0 9
michael@0 10 extern HINSTANCE g_hInstance;
michael@0 11 #ifndef _UNICODE
michael@0 12 extern bool g_IsNT;
michael@0 13 #endif
michael@0 14
michael@0 15 namespace NWindows {
michael@0 16
michael@0 17 CSysString MyLoadString(UINT resourceID)
michael@0 18 {
michael@0 19 CSysString s;
michael@0 20 int size = 256;
michael@0 21 int len;
michael@0 22 do
michael@0 23 {
michael@0 24 size += 256;
michael@0 25 len = ::LoadString(g_hInstance, resourceID, s.GetBuffer(size - 1), size);
michael@0 26 }
michael@0 27 while (size - len <= 1);
michael@0 28 s.ReleaseBuffer();
michael@0 29 return s;
michael@0 30 }
michael@0 31
michael@0 32 #ifndef _UNICODE
michael@0 33 UString MyLoadStringW(UINT resourceID)
michael@0 34 {
michael@0 35 if (g_IsNT)
michael@0 36 {
michael@0 37 UString s;
michael@0 38 int size = 256;
michael@0 39 int len;
michael@0 40 do
michael@0 41 {
michael@0 42 size += 256;
michael@0 43 len = ::LoadStringW(g_hInstance, resourceID, s.GetBuffer(size - 1), size);
michael@0 44 }
michael@0 45 while (size - len <= 1);
michael@0 46 s.ReleaseBuffer();
michael@0 47 return s;
michael@0 48 }
michael@0 49 return GetUnicodeString(MyLoadString(resourceID));
michael@0 50 }
michael@0 51 #endif
michael@0 52
michael@0 53 }

mercurial