diff options
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/w32/dllentry.cxx | 9 | ||||
-rw-r--r-- | sal/osl/w32/thread.cxx | 8 |
2 files changed, 8 insertions, 9 deletions
diff --git a/sal/osl/w32/dllentry.cxx b/sal/osl/w32/dllentry.cxx index 81139a05852b..5389c056d5a2 100644 --- a/sal/osl/w32/dllentry.cxx +++ b/sal/osl/w32/dllentry.cxx @@ -18,6 +18,7 @@ */ #include <systools/win32/uwinapi.h> +#include <process.h> #include <tlhelp32.h> #include <rpc.h> #include <winsock.h> @@ -159,7 +160,7 @@ static DWORD GetParentProcessId() return dwParentProcessId; } -static DWORD WINAPI ParentMonitorThreadProc( LPVOID lpParam ) +static unsigned __stdcall ParentMonitorThreadProc(void* lpParam) { DWORD_PTR dwParentProcessId = reinterpret_cast<DWORD_PTR>(lpParam); @@ -196,8 +197,6 @@ BOOL WINAPI DllMain( HINSTANCE, DWORD fdwReason, LPVOID ) if ( dwResult && dwResult < SAL_N_ELEMENTS(szBuffer) ) { - DWORD dwThreadId = 0; - DWORD_PTR dwParentProcessId = static_cast<DWORD_PTR>(_wtol( szBuffer )); if ( dwParentProcessId && GetParentProcessId() == dwParentProcessId ) @@ -205,8 +204,8 @@ BOOL WINAPI DllMain( HINSTANCE, DWORD fdwReason, LPVOID ) // No error check, it works or it does not // Thread should only be started for headless mode, see desktop/win32/source/officeloader.cxx HANDLE hThread - = CreateThread(nullptr, 0, ParentMonitorThreadProc, - reinterpret_cast<LPVOID>(dwParentProcessId), 0, &dwThreadId); + = reinterpret_cast<HANDLE>(_beginthreadex(nullptr, 0, ParentMonitorThreadProc, + reinterpret_cast<LPVOID>(dwParentProcessId), 0, nullptr)); // Note: calling CreateThread in DllMain is discouraged // but this is only done in the headless mode and in // that case no other threads should be running at startup diff --git a/sal/osl/w32/thread.cxx b/sal/osl/w32/thread.cxx index f6b3109adfb9..3640d43b9992 100644 --- a/sal/osl/w32/thread.cxx +++ b/sal/osl/w32/thread.cxx @@ -43,7 +43,7 @@ namespace { typedef struct { HANDLE m_hThread; /* OS-handle used for all thread-functions */ - DWORD m_ThreadId; /* identifier for this thread */ + unsigned m_ThreadId; /* identifier for this thread */ sal_Int32 m_nTerminationRequested; oslWorkerFunction m_WorkerFunction; void* m_pData; @@ -54,7 +54,7 @@ typedef struct static oslThread oslCreateThread(oslWorkerFunction pWorker, void* pThreadData, sal_uInt32 nFlags); -static DWORD WINAPI oslWorkerWrapperFunction(_In_ LPVOID pData) +static unsigned __stdcall oslWorkerWrapperFunction(void* pData) { osl_TThreadImpl* pThreadImpl= static_cast<osl_TThreadImpl*>(pData); @@ -89,13 +89,13 @@ static oslThread oslCreateThread(oslWorkerFunction pWorker, pThreadImpl->m_pData= pThreadData; pThreadImpl->m_nTerminationRequested= 0; - pThreadImpl->m_hThread= CreateThread( + pThreadImpl->m_hThread= reinterpret_cast<HANDLE>(_beginthreadex( nullptr, /* no security */ 0, /* default stack-size */ oslWorkerWrapperFunction, /* worker-function */ pThreadImpl, /* provide worker-function with data */ nFlags, /* start thread immediately or suspended */ - &pThreadImpl->m_ThreadId); + &pThreadImpl->m_ThreadId)); if(pThreadImpl->m_hThread == nullptr) { |