Build 0.75

This commit is contained in:
David Anderson 2004-02-07 23:03:48 +00:00
parent 8f68eb9457
commit 8d3dbd803c
2 changed files with 14 additions and 10 deletions

View File

@ -5,7 +5,7 @@
#include <signal.h> #include <signal.h>
#include <sched.h> #include <sched.h>
#endif #endif
#define VERSION "0.74" #define VERSION "0.75"
plugin_info_t Plugin_info = { plugin_info_t Plugin_info = {

View File

@ -1,6 +1,7 @@
/**************************************************************************** /****************************************************************************
* Project: AMX Mod X * Project: AMX Mod X
* By: BAILOPAN, JohnnyGotHisGun, Manip, PM, SniperBeamer * Engine module by: BAILOPAN
* AMX Mod X Team: BAILOPAN, JohnnyGotHisGun, Manip, PM, SniperBeamer
* *
* Purpose:Engine and entity related natives for AMXX scripting. * Purpose:Engine and entity related natives for AMXX scripting.
* *
@ -498,31 +499,34 @@ static cell AMX_NATIVE_CALL system_cmd(AMX *amx, cell *params)
int iLen, retVal, iLen2; int iLen, retVal, iLen2;
char *szCommand = AMX_GET_STRING(amx, params[2], iLen); char *szCommand = AMX_GET_STRING(amx, params[2], iLen);
char *szDirectory = AMX_GET_STRING(amx, params[3], iLen2); char *szDirectory = AMX_GET_STRING(amx, params[3], iLen2);
if (!iLen2) {
szDirectory = NULL;
}
#ifndef __linux__ #ifndef __linux__
STARTUPINFO si; STARTUPINFO si;
PROCESS_INFORMATION pi; PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si)); ZeroMemory(&si, sizeof(si));
if (i_apptype & 2) {
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
}
si.cb = sizeof(si); si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi)); ZeroMemory(&pi, sizeof(pi));
if (!i_apptype) { if (!i_apptype & 1) {
if (!CreateProcess(NULL, (LPTSTR)szCommand, NULL, NULL, FALSE, 0, NULL, (LPCTSTR)szDirectory, &si, &pi)) { if (!CreateProcess(NULL, (LPTSTR)szCommand, NULL, NULL, FALSE, 0, NULL, (LPCTSTR)szDirectory, &si, &pi)) {
return 0; return 0;
} else { } else {
retVal = 1; retVal = 1;
} }
} else if (i_apptype == 1) { } else {
if (!CreateProcess((LPCTSTR)szCommand, NULL, NULL, NULL, FALSE, 0, NULL, (LPCTSTR)szDirectory, &si, &pi)) { if (!CreateProcess((LPCTSTR)szCommand, NULL, NULL, NULL, FALSE, 0, NULL, (LPCTSTR)szDirectory, &si, &pi)) {
return 0; return 0;
} else { } else {
retVal = 1; retVal = 1;
} }
} }
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
#else #else
void *stack; void *stack;
pid_t pid; pid_t pid;
@ -531,12 +535,12 @@ static cell AMX_NATIVE_CALL system_cmd(AMX *amx, cell *params)
app_type = 64; app_type = 64;
} }
stack = malloc(app_type * 64); stack = malloc(app_type * 1024);
if (stack == 0) { if (stack == 0) {
return -1; return -1;
} }
pid = clone(&thread_fork, (char *)stack + app_type*64, 0, szCommand); pid = clone(&thread_fork, (char *)stack + app_type*1024, 0, szCommand);
if (pid == -1) { if (pid == -1) {
return -1; return -1;
} }