mirror of
https://github.com/Ylianst/MeshAgent
synced 2026-02-05 19:23:27 +00:00
Added system language query to Windows Service Installer
This commit is contained in:
@@ -1041,6 +1041,11 @@ INT_PTR CALLBACK DialogHandler(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
char selfexe[_MAX_PATH];
|
||||
char *lang = NULL;
|
||||
void *chain = ILibCreateChain();
|
||||
ILibChain_PartialStart(chain);
|
||||
duk_context *ctx = ILibDuktape_ScriptContainer_InitializeJavaScriptEngineEx(0, 0, chain, NULL, NULL, "", NULL, NULL, chain);
|
||||
if (duk_peval_string(ctx, "require('util-language').current;") == 0) { lang = (char*)duk_safe_to_string(ctx, -1); }
|
||||
|
||||
// Get current executable path
|
||||
WCHAR wselfexe[MAX_PATH];
|
||||
@@ -1168,7 +1173,9 @@ INT_PTR CALLBACK DialogHandler(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
|
||||
}
|
||||
SetWindowTextA(GetDlgItem(hDlg, IDC_STATUSTEXT), txt);
|
||||
if (mshfile != NULL) { free(mshfile); }
|
||||
|
||||
Duktape_SafeDestroyHeap(ctx);
|
||||
ILibStopChain(chain);
|
||||
ILibStartChain(chain);
|
||||
return (INT_PTR)TRUE;
|
||||
}
|
||||
case WM_COMMAND:
|
||||
|
||||
@@ -990,6 +990,7 @@ typedef struct ILibBaseChain
|
||||
#else
|
||||
int WatchDogTerminator[2];
|
||||
#endif
|
||||
int preInitialized;
|
||||
int selectTimeout;
|
||||
void *node;
|
||||
int lastDescriptorCount;
|
||||
@@ -3623,34 +3624,16 @@ void ILibChain_RemoveWaitHandle(void *chain, HANDLE h)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*! \fn ILibStartChain(void *Chain)
|
||||
\brief Starts a Chain
|
||||
\par
|
||||
This method will use the current thread. This thread will be refered to as the
|
||||
microstack thread. All events and processing will be done on this thread. This method
|
||||
will not return until ILibStopChain is called.
|
||||
\param Chain The chain to start
|
||||
*/
|
||||
ILibExportMethod void ILibStartChain(void *Chain)
|
||||
void ILibChain_PartialStart(void *Chain)
|
||||
{
|
||||
if (Chain == NULL) { return; }
|
||||
ILibBaseChain *chain = (ILibBaseChain*)Chain;
|
||||
ILibChain_Link *module;
|
||||
ILibChain_Link_Hook *nodeHook;
|
||||
|
||||
fd_set readset;
|
||||
fd_set errorset;
|
||||
fd_set writeset;
|
||||
|
||||
#ifdef WIN32
|
||||
HANDLE selectHandles[FD_SETSIZE];
|
||||
memset(selectHandles, 0, sizeof(selectHandles));
|
||||
memset(chain->WaitHandles, 0, sizeof(chain->WaitHandles));
|
||||
#endif
|
||||
struct timeval tv;
|
||||
int slct;
|
||||
int vX;
|
||||
|
||||
if (Chain == NULL) { return; }
|
||||
chain->PreSelectCount = chain->PostSelectCount = 0;
|
||||
|
||||
#if defined(WIN32)
|
||||
@@ -3662,7 +3645,7 @@ ILibExportMethod void ILibStartChain(void *Chain)
|
||||
chain->ChainThreadID = pthread_self();
|
||||
#endif
|
||||
|
||||
if (gILibChain == NULL) {gILibChain = Chain;} // Set the global instance if it's not already set
|
||||
if (gILibChain == NULL) { gILibChain = Chain; } // Set the global instance if it's not already set
|
||||
#if defined(ILibChain_WATCHDOG_TIMEOUT)
|
||||
#ifdef WIN32
|
||||
chain->WatchDogTerminator = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
@@ -3685,10 +3668,6 @@ ILibExportMethod void ILibStartChain(void *Chain)
|
||||
//
|
||||
// Use this thread as if it's our own. Keep looping until we are signaled to stop
|
||||
//
|
||||
FD_ZERO(&readset);
|
||||
FD_ZERO(&errorset);
|
||||
FD_ZERO(&writeset);
|
||||
|
||||
#if defined(_POSIX)
|
||||
//
|
||||
// For posix, we need to use a pipe to force unblock the select loop
|
||||
@@ -3702,6 +3681,42 @@ ILibExportMethod void ILibStartChain(void *Chain)
|
||||
#endif
|
||||
|
||||
chain->RunningFlag = 1;
|
||||
chain->preInitialized = 1;
|
||||
}
|
||||
|
||||
|
||||
/*! \fn ILibStartChain(void *Chain)
|
||||
\brief Starts a Chain
|
||||
\par
|
||||
This method will use the current thread. This thread will be refered to as the
|
||||
microstack thread. All events and processing will be done on this thread. This method
|
||||
will not return until ILibStopChain is called.
|
||||
\param Chain The chain to start
|
||||
*/
|
||||
ILibExportMethod void ILibStartChain(void *Chain)
|
||||
{
|
||||
ILibBaseChain *chain = (ILibBaseChain*)Chain;
|
||||
if (Chain == NULL) { return; }
|
||||
if (chain->preInitialized == 0) { ILibChain_PartialStart(Chain); }
|
||||
|
||||
ILibChain_Link *module;
|
||||
ILibChain_Link_Hook *nodeHook;
|
||||
|
||||
fd_set readset;
|
||||
fd_set errorset;
|
||||
fd_set writeset;
|
||||
|
||||
struct timeval tv;
|
||||
int slct;
|
||||
int vX;
|
||||
|
||||
//
|
||||
// Use this thread as if it's our own. Keep looping until we are signaled to stop
|
||||
//
|
||||
FD_ZERO(&readset);
|
||||
FD_ZERO(&errorset);
|
||||
FD_ZERO(&writeset);
|
||||
|
||||
while (chain->TerminateFlag == 0)
|
||||
{
|
||||
slct = 0;
|
||||
|
||||
@@ -1091,6 +1091,7 @@ int ILibIsRunningOnChainThread(void* chain);
|
||||
|
||||
void ILibChain_InitDescriptorCount(void *chain);
|
||||
int ILibChain_GetDescriptorCount(void *chain);
|
||||
void ILibChain_PartialStart(void *chain);
|
||||
ILibExportMethod void ILibStartChain(void *chain);
|
||||
ILibExportMethod void ILibStopChain(void *chain);
|
||||
#ifdef WIN32
|
||||
|
||||
Reference in New Issue
Block a user