Merge pull request #5077 from akallabeth/win_client_fixes
Win client fixes
This commit is contained in:
commit
4108fc51a9
@ -490,12 +490,6 @@ if(WIN32)
|
||||
message(FATAL_ERROR "Unknown generator ${CMAKE_GENERATOR}")
|
||||
endif()
|
||||
|
||||
# Set product and vendor for dll and exe version information.
|
||||
set(RC_VERSION_VENDOR ${VENDOR})
|
||||
set(RC_VERSION_PRODUCT ${PRODUCT})
|
||||
set(RC_VERSION_PATCH ${BUILD_NUMBER})
|
||||
set(RC_VERSION_DESCRIPTION ${GIT_REVISION})
|
||||
|
||||
string(TIMESTAMP RC_VERSION_YEAR "%Y")
|
||||
|
||||
if(NOT DEFINED CMAKE_WINDOWS_VERSION)
|
||||
@ -512,6 +506,12 @@ if(WIN32)
|
||||
add_definitions(-DWINVER=0x0A00 -D_WIN32_WINNT=0x0A00)
|
||||
endif()
|
||||
|
||||
# Set product and vendor for dll and exe version information.
|
||||
set(RC_VERSION_VENDOR ${VENDOR})
|
||||
set(RC_VERSION_PRODUCT ${PRODUCT})
|
||||
set(RC_VERSION_PATCH ${BUILD_NUMBER})
|
||||
set(RC_VERSION_DESCRIPTION "${FREERDP_VERSION_FULL} ${GIT_REVISION} ${CMAKE_WINDOWS_VERSION} ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
|
||||
if (FREERDP_EXTERNAL_SSL_PATH)
|
||||
set(OPENSSL_ROOT_DIR ${FREERDP_EXTERNAL_SSL_PATH})
|
||||
endif()
|
||||
|
@ -82,7 +82,7 @@ struct _CliprdrStream
|
||||
IStream iStream;
|
||||
|
||||
LONG m_lRefCount;
|
||||
LONG m_lIndex;
|
||||
ULONG m_lIndex;
|
||||
ULARGE_INTEGER m_lSize;
|
||||
ULARGE_INTEGER m_lOffset;
|
||||
FILEDESCRIPTORW m_Dsc;
|
||||
@ -97,8 +97,8 @@ struct _CliprdrDataObject
|
||||
LONG m_lRefCount;
|
||||
FORMATETC* m_pFormatEtc;
|
||||
STGMEDIUM* m_pStgMedium;
|
||||
LONG m_nNumFormats;
|
||||
LONG m_nStreams;
|
||||
ULONG m_nNumFormats;
|
||||
ULONG m_nStreams;
|
||||
IStream** m_pStream;
|
||||
void* m_pData;
|
||||
};
|
||||
@ -155,12 +155,12 @@ static UINT cliprdr_send_lock(wfClipboard* clipboard);
|
||||
static UINT cliprdr_send_unlock(wfClipboard* clipboard);
|
||||
static UINT cliprdr_send_request_filecontents(wfClipboard* clipboard,
|
||||
const void* streamid,
|
||||
LONG index, int flag, DWORD positionhigh,
|
||||
ULONG index, UINT32 flag, DWORD positionhigh,
|
||||
DWORD positionlow, ULONG request);
|
||||
|
||||
static void CliprdrDataObject_Delete(CliprdrDataObject* instance);
|
||||
|
||||
static CliprdrEnumFORMATETC* CliprdrEnumFORMATETC_New(int nFormats,
|
||||
static CliprdrEnumFORMATETC* CliprdrEnumFORMATETC_New(ULONG nFormats,
|
||||
FORMATETC* pFormatEtc);
|
||||
static void CliprdrEnumFORMATETC_Delete(CliprdrEnumFORMATETC* instance);
|
||||
|
||||
@ -408,7 +408,7 @@ static HRESULT STDMETHODCALLTYPE CliprdrStream_Clone(IStream* This,
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static CliprdrStream* CliprdrStream_New(LONG index, void* pData,
|
||||
static CliprdrStream* CliprdrStream_New(ULONG index, void* pData,
|
||||
const FILEDESCRIPTORW* dsc)
|
||||
{
|
||||
IStream* iStream;
|
||||
@ -491,10 +491,10 @@ void CliprdrStream_Delete(CliprdrStream* instance)
|
||||
* IDataObject
|
||||
*/
|
||||
|
||||
static int cliprdr_lookup_format(CliprdrDataObject* instance,
|
||||
FORMATETC* pFormatEtc)
|
||||
static LONG cliprdr_lookup_format(CliprdrDataObject* instance,
|
||||
FORMATETC* pFormatEtc)
|
||||
{
|
||||
int i;
|
||||
ULONG i;
|
||||
|
||||
if (!instance || !pFormatEtc)
|
||||
return -1;
|
||||
@ -505,7 +505,7 @@ static int cliprdr_lookup_format(CliprdrDataObject* instance,
|
||||
pFormatEtc->cfFormat == instance->m_pFormatEtc[i].cfFormat &&
|
||||
pFormatEtc->dwAspect & instance->m_pFormatEtc[i].dwAspect)
|
||||
{
|
||||
return i;
|
||||
return (LONG)i;
|
||||
}
|
||||
}
|
||||
|
||||
@ -565,7 +565,8 @@ static ULONG STDMETHODCALLTYPE CliprdrDataObject_Release(IDataObject* This)
|
||||
static HRESULT STDMETHODCALLTYPE CliprdrDataObject_GetData(
|
||||
IDataObject* This, FORMATETC* pFormatEtc, STGMEDIUM* pMedium)
|
||||
{
|
||||
int i, idx;
|
||||
ULONG i;
|
||||
LONG idx;
|
||||
CliprdrDataObject* instance = (CliprdrDataObject*) This;
|
||||
wfClipboard* clipboard;
|
||||
|
||||
@ -747,7 +748,7 @@ static HRESULT STDMETHODCALLTYPE CliprdrDataObject_EnumDAdvise(
|
||||
}
|
||||
|
||||
static CliprdrDataObject* CliprdrDataObject_New(
|
||||
FORMATETC* fmtetc, STGMEDIUM* stgmed, int count, void* data)
|
||||
FORMATETC* fmtetc, STGMEDIUM* stgmed, ULONG count, void* data)
|
||||
{
|
||||
int i;
|
||||
CliprdrDataObject* instance;
|
||||
@ -817,7 +818,7 @@ void CliprdrDataObject_Delete(CliprdrDataObject* instance)
|
||||
|
||||
if (instance->m_pStream)
|
||||
{
|
||||
LONG i;
|
||||
ULONG i;
|
||||
|
||||
for (i = 0; i < instance->m_nStreams; i++)
|
||||
CliprdrStream_Release(instance->m_pStream[i]);
|
||||
@ -999,10 +1000,10 @@ static HRESULT STDMETHODCALLTYPE CliprdrEnumFORMATETC_Clone(
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
CliprdrEnumFORMATETC* CliprdrEnumFORMATETC_New(int nFormats,
|
||||
CliprdrEnumFORMATETC* CliprdrEnumFORMATETC_New(ULONG nFormats,
|
||||
FORMATETC* pFormatEtc)
|
||||
{
|
||||
int i;
|
||||
ULONG i;
|
||||
CliprdrEnumFORMATETC* instance;
|
||||
IEnumFORMATETC* iEnumFORMATETC;
|
||||
|
||||
@ -1028,7 +1029,7 @@ CliprdrEnumFORMATETC* CliprdrEnumFORMATETC_New(int nFormats,
|
||||
iEnumFORMATETC->lpVtbl->Skip = CliprdrEnumFORMATETC_Skip;
|
||||
iEnumFORMATETC->lpVtbl->Reset = CliprdrEnumFORMATETC_Reset;
|
||||
iEnumFORMATETC->lpVtbl->Clone = CliprdrEnumFORMATETC_Clone;
|
||||
instance->m_lRefCount = 0;
|
||||
instance->m_lRefCount = 1;
|
||||
instance->m_nIndex = 0;
|
||||
instance->m_nNumFormats = nFormats;
|
||||
|
||||
@ -1332,7 +1333,7 @@ static UINT cliprdr_send_data_request(wfClipboard* clipboard, UINT32 formatId)
|
||||
|
||||
UINT cliprdr_send_request_filecontents(wfClipboard* clipboard,
|
||||
const void* streamid,
|
||||
LONG index, int flag, DWORD positionhigh,
|
||||
ULONG index, UINT32 flag, DWORD positionhigh,
|
||||
DWORD positionlow, ULONG nreq)
|
||||
{
|
||||
UINT rc;
|
||||
@ -1504,12 +1505,15 @@ static LRESULT CALLBACK cliprdr_proc(HWND hWnd, UINT Msg, WPARAM wParam,
|
||||
case OLE_SETCLIPBOARD:
|
||||
DEBUG_CLIPRDR("info: OLE_SETCLIPBOARD");
|
||||
|
||||
if (wf_create_file_obj(clipboard, &clipboard->data_obj))
|
||||
if (S_FALSE == OleIsCurrentClipboard(clipboard->data_obj))
|
||||
{
|
||||
if (OleSetClipboard(clipboard->data_obj) != S_OK)
|
||||
if (wf_create_file_obj(clipboard, &clipboard->data_obj))
|
||||
{
|
||||
wf_destroy_file_obj(clipboard->data_obj);
|
||||
clipboard->data_obj = NULL;
|
||||
if (OleSetClipboard(clipboard->data_obj) != S_OK)
|
||||
{
|
||||
wf_destroy_file_obj(clipboard->data_obj);
|
||||
clipboard->data_obj = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2438,7 +2442,7 @@ error:
|
||||
*/
|
||||
static UINT wf_cliprdr_server_file_contents_response(CliprdrClientContext*
|
||||
context,
|
||||
const CLIPRDR_FILE_CONTENTS_RESPONSE* fileContentsResponse)
|
||||
CLIPRDR_FILE_CONTENTS_RESPONSE* fileContentsResponse)
|
||||
{
|
||||
wfClipboard* clipboard;
|
||||
|
||||
@ -2564,14 +2568,13 @@ BOOL wf_cliprdr_uninit(wfContext* wfc, CliprdrClientContext* cliprdr)
|
||||
{
|
||||
WaitForSingleObject(clipboard->thread, INFINITE);
|
||||
CloseHandle(clipboard->thread);
|
||||
clipboard->thread = NULL;
|
||||
}
|
||||
|
||||
if (clipboard->response_data_event)
|
||||
{
|
||||
CloseHandle(clipboard->response_data_event);
|
||||
clipboard->response_data_event = NULL;
|
||||
}
|
||||
|
||||
if (clipboard->req_fevent)
|
||||
CloseHandle(clipboard->req_fevent);
|
||||
|
||||
clear_file_array(clipboard);
|
||||
clear_format_map(clipboard);
|
||||
|
@ -26,10 +26,10 @@
|
||||
#include "wf_input.h"
|
||||
#include "wf_info.h"
|
||||
|
||||
void wf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
BOOL wf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
{
|
||||
INPUT keyboard_event;
|
||||
|
||||
WINPR_UNUSED(input);
|
||||
keyboard_event.type = INPUT_KEYBOARD;
|
||||
keyboard_event.ki.wVk = 0;
|
||||
keyboard_event.ki.wScan = code;
|
||||
@ -44,12 +44,13 @@ void wf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
keyboard_event.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY;
|
||||
|
||||
SendInput(1, &keyboard_event, sizeof(INPUT));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wf_peer_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
BOOL wf_peer_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
{
|
||||
INPUT keyboard_event;
|
||||
|
||||
WINPR_UNUSED(input);
|
||||
keyboard_event.type = INPUT_KEYBOARD;
|
||||
keyboard_event.ki.wVk = 0;
|
||||
keyboard_event.ki.wScan = code;
|
||||
@ -61,13 +62,14 @@ void wf_peer_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
keyboard_event.ki.dwFlags |= KEYEVENTF_KEYUP;
|
||||
|
||||
SendInput(1, &keyboard_event, sizeof(INPUT));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wf_peer_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
BOOL wf_peer_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
{
|
||||
INPUT mouse_event;
|
||||
float width, height;
|
||||
|
||||
WINPR_UNUSED(input);
|
||||
ZeroMemory(&mouse_event, sizeof(INPUT));
|
||||
mouse_event.type = INPUT_MOUSE;
|
||||
|
||||
@ -83,21 +85,19 @@ void wf_peer_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
}
|
||||
else
|
||||
{
|
||||
wfInfo * wfi;
|
||||
|
||||
wfInfo* wfi;
|
||||
wfi = wf_info_get_instance();
|
||||
|
||||
if (!wfi)
|
||||
return;
|
||||
return FALSE;
|
||||
|
||||
//width and height of primary screen (even in multimon setups
|
||||
width = (float) GetSystemMetrics(SM_CXSCREEN);
|
||||
height = (float) GetSystemMetrics(SM_CYSCREEN);
|
||||
|
||||
x += wfi->servscreen_xoffset;
|
||||
y += wfi->servscreen_yoffset;
|
||||
|
||||
mouse_event.mi.dx = (LONG) ((float) x * (65535.0f / width));
|
||||
mouse_event.mi.dy = (LONG) ((float) y * (65535.0f / height));
|
||||
mouse_event.mi.dx = (LONG)((float) x * (65535.0f / width));
|
||||
mouse_event.mi.dy = (LONG)((float) y * (65535.0f / height));
|
||||
mouse_event.mi.dwFlags = MOUSEEVENTF_ABSOLUTE;
|
||||
|
||||
if (flags & PTR_FLAGS_MOVE)
|
||||
@ -136,36 +136,35 @@ void wf_peer_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
SendInput(1, &mouse_event, sizeof(INPUT));
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wf_peer_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
BOOL wf_peer_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
{
|
||||
if ((flags & PTR_XFLAGS_BUTTON1) || (flags & PTR_XFLAGS_BUTTON2))
|
||||
{
|
||||
INPUT mouse_event;
|
||||
ZeroMemory(&mouse_event, sizeof(INPUT));
|
||||
|
||||
mouse_event.type = INPUT_MOUSE;
|
||||
|
||||
if (flags & PTR_FLAGS_MOVE)
|
||||
{
|
||||
float width, height;
|
||||
wfInfo * wfi;
|
||||
|
||||
wfInfo* wfi;
|
||||
wfi = wf_info_get_instance();
|
||||
|
||||
if (!wfi)
|
||||
return;
|
||||
return FALSE;
|
||||
|
||||
//width and height of primary screen (even in multimon setups
|
||||
width = (float) GetSystemMetrics(SM_CXSCREEN);
|
||||
height = (float) GetSystemMetrics(SM_CYSCREEN);
|
||||
|
||||
x += wfi->servscreen_xoffset;
|
||||
y += wfi->servscreen_yoffset;
|
||||
|
||||
mouse_event.mi.dx = (LONG) ((float) x * (65535.0f / width));
|
||||
mouse_event.mi.dy = (LONG) ((float) y * (65535.0f / height));
|
||||
mouse_event.mi.dx = (LONG)((float) x * (65535.0f / width));
|
||||
mouse_event.mi.dy = (LONG)((float) y * (65535.0f / height));
|
||||
mouse_event.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
|
||||
|
||||
SendInput(1, &mouse_event, sizeof(INPUT));
|
||||
}
|
||||
|
||||
@ -187,21 +186,40 @@ void wf_peer_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT1
|
||||
{
|
||||
wf_peer_mouse_event(input, flags, x, y);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void wf_peer_keyboard_event_dummy(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
BOOL wf_peer_keyboard_event_dummy(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
{
|
||||
WINPR_UNUSED(input);
|
||||
WINPR_UNUSED(flags);
|
||||
WINPR_UNUSED(code);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wf_peer_unicode_keyboard_event_dummy(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
BOOL wf_peer_unicode_keyboard_event_dummy(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
{
|
||||
WINPR_UNUSED(input);
|
||||
WINPR_UNUSED(flags);
|
||||
WINPR_UNUSED(code);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wf_peer_mouse_event_dummy(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
BOOL wf_peer_mouse_event_dummy(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
{
|
||||
WINPR_UNUSED(input);
|
||||
WINPR_UNUSED(flags);
|
||||
WINPR_UNUSED(x);
|
||||
WINPR_UNUSED(y);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wf_peer_extended_mouse_event_dummy(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
BOOL wf_peer_extended_mouse_event_dummy(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
{
|
||||
WINPR_UNUSED(input);
|
||||
WINPR_UNUSED(flags);
|
||||
WINPR_UNUSED(x);
|
||||
WINPR_UNUSED(y);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -22,15 +22,15 @@
|
||||
|
||||
#include "wf_interface.h"
|
||||
|
||||
void wf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code);
|
||||
void wf_peer_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code);
|
||||
void wf_peer_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
|
||||
void wf_peer_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
|
||||
BOOL wf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code);
|
||||
BOOL wf_peer_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code);
|
||||
BOOL wf_peer_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
|
||||
BOOL wf_peer_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
|
||||
|
||||
//dummy versions
|
||||
void wf_peer_keyboard_event_dummy(rdpInput* input, UINT16 flags, UINT16 code);
|
||||
void wf_peer_unicode_keyboard_event_dummy(rdpInput* input, UINT16 flags, UINT16 code);
|
||||
void wf_peer_mouse_event_dummy(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
|
||||
void wf_peer_extended_mouse_event_dummy(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
|
||||
BOOL wf_peer_keyboard_event_dummy(rdpInput* input, UINT16 flags, UINT16 code);
|
||||
BOOL wf_peer_unicode_keyboard_event_dummy(rdpInput* input, UINT16 flags, UINT16 code);
|
||||
BOOL wf_peer_mouse_event_dummy(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
|
||||
BOOL wf_peer_extended_mouse_event_dummy(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
|
||||
|
||||
#endif /* FREERDP_SERVER_WIN_INPUT_H */
|
||||
|
@ -92,7 +92,6 @@ static BOOL wf_peer_init(freerdp_peer* client)
|
||||
|
||||
static BOOL wf_peer_post_connect(freerdp_peer* client)
|
||||
{
|
||||
int i;
|
||||
wfInfo* wfi;
|
||||
rdpSettings* settings;
|
||||
wfPeerContext* context = (wfPeerContext*) client->context;
|
||||
@ -150,8 +149,9 @@ static BOOL wf_peer_logon(freerdp_peer* client, SEC_WINNT_AUTH_IDENTITY* identit
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void wf_peer_synchronize_event(rdpInput* input, UINT32 flags)
|
||||
static BOOL wf_peer_synchronize_event(rdpInput* input, UINT32 flags)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL wf_peer_accepted(freerdp_listener* instance, freerdp_peer* client)
|
||||
|
@ -20,16 +20,16 @@
|
||||
|
||||
#if DEFINE_UNICODE
|
||||
|
||||
HRESULT PATH_ALLOC_COMBINE(PCWSTR pszPathIn, PCWSTR pszMore, unsigned long dwFlags, PWSTR* ppszPathOut)
|
||||
HRESULT PATH_ALLOC_COMBINE(PCWSTR pszPathIn, PCWSTR pszMore, unsigned long dwFlags,
|
||||
PWSTR* ppszPathOut)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
PWSTR pszPathOut;
|
||||
BOOL backslashIn;
|
||||
BOOL backslashMore;
|
||||
int pszMoreLength;
|
||||
int pszPathInLength;
|
||||
int pszPathOutLength;
|
||||
|
||||
size_t pszMoreLength;
|
||||
size_t pszPathInLength;
|
||||
size_t pszPathOutLength;
|
||||
WLog_WARN(TAG, "%s: has known bugs and needs fixing.", __FUNCTION__);
|
||||
|
||||
if (!ppszPathOut)
|
||||
@ -59,29 +59,25 @@ HRESULT PATH_ALLOC_COMBINE(PCWSTR pszPathIn, PCWSTR pszMore, unsigned long dwFla
|
||||
if ((pszPathIn[1] == ':') && (pszPathIn[2] == _PATH_SEPARATOR_CHR))
|
||||
{
|
||||
size_t sizeOfBuffer;
|
||||
|
||||
pszPathOutLength = 2 + pszMoreLength;
|
||||
sizeOfBuffer = (pszPathOutLength + 1) * 2;
|
||||
|
||||
pszPathOut = (PWSTR) HeapAlloc(GetProcessHeap(), 0, sizeOfBuffer * 2);
|
||||
|
||||
if (!pszPathOut)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
swprintf_s(pszPathOut, sizeOfBuffer, L"%c:%s", pszPathIn[0], pszMore);
|
||||
|
||||
*ppszPathOut = pszPathOut;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t sizeOfBuffer;
|
||||
|
||||
pszPathOutLength = pszPathInLength + pszMoreLength;
|
||||
sizeOfBuffer = (pszPathOutLength + 1) * 2;
|
||||
|
||||
pszPathOut = (PWSTR) HeapAlloc(GetProcessHeap(), 0, sizeOfBuffer * 2);
|
||||
|
||||
if (!pszPathOut)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
@ -91,11 +87,10 @@ HRESULT PATH_ALLOC_COMBINE(PCWSTR pszPathIn, PCWSTR pszMore, unsigned long dwFla
|
||||
swprintf_s(pszPathOut, sizeOfBuffer, L"%s" _PATH_SEPARATOR_STR L"%s", pszPathIn, pszMore);
|
||||
|
||||
*ppszPathOut = pszPathOut;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@ -109,7 +104,6 @@ HRESULT PATH_ALLOC_COMBINE(PCSTR pszPathIn, PCSTR pszMore, unsigned long dwFlags
|
||||
int pszMoreLength;
|
||||
int pszPathInLength;
|
||||
int pszPathOutLength;
|
||||
|
||||
WLog_WARN(TAG, "%s: has known bugs and needs fixing.", __FUNCTION__);
|
||||
|
||||
if (!ppszPathOut)
|
||||
@ -139,29 +133,25 @@ HRESULT PATH_ALLOC_COMBINE(PCSTR pszPathIn, PCSTR pszMore, unsigned long dwFlags
|
||||
if ((pszPathIn[1] == ':') && (pszPathIn[2] == _PATH_SEPARATOR_CHR))
|
||||
{
|
||||
size_t sizeOfBuffer;
|
||||
|
||||
pszPathOutLength = 2 + pszMoreLength;
|
||||
sizeOfBuffer = (pszPathOutLength + 1) * 2;
|
||||
|
||||
pszPathOut = (PSTR) HeapAlloc(GetProcessHeap(), 0, sizeOfBuffer * 2);
|
||||
|
||||
if (!pszPathOut)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
sprintf_s(pszPathOut, sizeOfBuffer, "%c:%s", pszPathIn[0], pszMore);
|
||||
|
||||
*ppszPathOut = pszPathOut;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t sizeOfBuffer;
|
||||
|
||||
pszPathOutLength = pszPathInLength + pszMoreLength;
|
||||
sizeOfBuffer = (pszPathOutLength + 1) * 2;
|
||||
|
||||
pszPathOut = (PSTR) HeapAlloc(GetProcessHeap(), 0, sizeOfBuffer * 2);
|
||||
|
||||
if (!pszPathOut)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
@ -171,7 +161,6 @@ HRESULT PATH_ALLOC_COMBINE(PCSTR pszPathIn, PCSTR pszMore, unsigned long dwFlags
|
||||
sprintf_s(pszPathOut, sizeOfBuffer, "%s" _PATH_SEPARATOR_STR "%s", pszPathIn, pszMore);
|
||||
|
||||
*ppszPathOut = pszPathOut;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user