Skip to content

Commit a982afa

Browse files
Add files via upload
1 parent 952f1fc commit a982afa

File tree

4 files changed

+123
-0
lines changed

4 files changed

+123
-0
lines changed

ico/bsfslauncher.ico

36 KB
Binary file not shown.

ico/ql.ico

45.3 KB
Binary file not shown.

msvc_build.cmd

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
@echo off
2+
set "name=%1"
3+
set "ico_name=%name%"
4+
set "subsys=WINDOWS"
5+
set "seh=/EHsc"
6+
set "optim=/O2 /Oi /GL /Gy"
7+
set "linkopt=/LTCG"
8+
set "warns=/Wall"
9+
set "slib="
10+
set "asm="
11+
set "debug=/MD"
12+
set "debug_link="
13+
set "debug_def="
14+
set "no_launch="
15+
set "res_file="
16+
cd "%2"
17+
18+
if not exist ico goto :noico
19+
if not exist ico\%ico_name%.ico set ico_name=main
20+
21+
echo MAINICON ICON "ico\\%ico_name%.ico"> ico\res.rc
22+
rc /r /nologo ico\res.rc
23+
set res_file=ico\res.res
24+
25+
:noico
26+
27+
nppsave
28+
29+
title sd_msvc_build
30+
31+
if %name%==small set subsys=CONSOLE
32+
33+
set /p fline=< %name%.cpp
34+
35+
:parse_loop
36+
for /f "tokens=1,* delims= " %%a in ("%fline%") do (
37+
if "%%a"=="CONSOLE" set "subsys=CONSOLE"
38+
if "%%a"=="DSEH" set "seh=/wd4577"
39+
if "%%a"=="NOPT" set "optim=/Od" & set "linkopt="
40+
if "%%a"=="NW" set "warns=/w"
41+
if "%%a"=="SLIB" set "slib=/c" & set "res_file="
42+
if "%%a"=="ASM" set "asm=/FAcsu"
43+
if "%%a"=="DBG" set "debug=/MDd /Z7" & set "debug_link=/DEBUG" & set "debug_def=/D DEBUG"
44+
if "%%a"=="NLAUNCH" set "no_launch=no"
45+
46+
47+
set "fline=%%b"
48+
goto :parse_loop
49+
)
50+
51+
:recompile
52+
cl %warns% /wd4530 /wd4710 /wd4711 /wd5045 /external:anglebrackets /external:W0 /diagnostics:caret /I %2 %optim% %debug_def% /D _%subsys% /D _UNICODE /D UNICODE /D _CRT_SECURE_NO_WARNINGS /Gm- %seh% %debug% /GS- /J /Zc:wchar_t /Zc:forScope /Zc:inline /permissive- /nologo %slib% %asm% %name%.cpp %res_file% /link /SUBSYSTEM:%subsys% %linkopt% %debug_link% /DYNAMICBASE:NO /MACHINE:X64 /ENTRY:wmainCRTStartup | vcstyle
53+
54+
::#pragma warning has priority over switches
55+
::C4514 The optimizer removed an inline function that is not called. (DISABLE CANDIDATE)
56+
::C4530 C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
57+
::C4710 function not inlined (code gen.)
58+
::C4711 function selected for automatic inline expansion (code gen.)
59+
::C5045 Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified (code gen.)
60+
61+
if %ERRORLEVEL% EQU 1 pause > nul & exit
62+
if %ERRORLEVEL% EQU 2 pause > nul
63+
64+
if "%slib%"=="/c" ( if "%debug_link%"=="/DEBUG" (
65+
lib /NOLOGO /VERBOSE /OUT:%name%d.lib %name%.obj ) else (
66+
lib /NOLOGO /VERBOSE %name%.obj
67+
set "debug=/MDd /Z7" & set "debug_link=/DEBUG" & set "debug_def=/D DEBUG"
68+
goto :recompile )
69+
if %ERRORLEVEL% NEQ 0 ( pause > nul & goto :cleanup ) else ( goto :cleanup ) )
70+
71+
::pause > nul
72+
if "%asm%"=="/FAcsu" notepad++ %name%.cod & goto :cleanup
73+
if "%debug_link%"=="/DEBUG" start sddbg %name%.exe & goto :cleanup
74+
75+
if "%no_launch%"=="" start "%name%" %name%.exe
76+
:cleanup
77+
del ico\res.rc ico\res.res %name%.obj
78+
taskkill /f /im cmd.exe /fi "windowtitle eq sd_msvc_build"

ql.cpp

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#define WIN32_LEAN_AND_MEAN
2+
#include <windows.h>
3+
4+
int wmain(int argc, wchar_t **argv)
5+
{
6+
if(argc == 1)
7+
{
8+
return 1;
9+
}
10+
11+
// NEVER QUOTE lpApplicationName IT SCREWS UP PARSING RESULTING IN ACESS_DENIED (ERR5)
12+
//LPCSTR app = "cmd /q /c C:\\ScienceDiscoverer\\DOCS\\HOMIP_PING.cmd";
13+
STARTUPINFO si;
14+
PROCESS_INFORMATION pi;
15+
16+
memset(&si, 0, sizeof(si));
17+
si.cb = sizeof(si);
18+
memset(&pi, 0, sizeof(pi));
19+
20+
// Create Process ============================================================================
21+
BOOL res = CreateProcess(
22+
NULL, // [I|O] Name of the module to be executed, that's it
23+
argv[1], // [IO|O] Command line to be exectued, searches PATH, adds extention
24+
NULL, // [I|O] Sec. Attrib. for inhereting new process by child processes
25+
NULL, // [I|O] Sec. Attrib. for inhereting new thread by child processes
26+
FALSE, // [I] New proc. inherits each inheritable handle
27+
CREATE_NO_WINDOW, // [I] Process creation flags
28+
NULL, // [I|O] Ptr to environment block of new process (inherit if NULL)
29+
NULL, // [I|O] Full path to current directory for the process
30+
&si, // [I] Ptr to STARTUPINFO struct, if dwFlags = 0, def. values used
31+
&pi); // [O] Ptr to PROCESS_INFORMATION struct with new proc identification info
32+
// ===========================================================================================
33+
34+
if(res)
35+
{
36+
CloseHandle(pi.hProcess);
37+
CloseHandle(pi.hThread);
38+
}
39+
else
40+
{
41+
return -1;
42+
}
43+
44+
return 0;
45+
}

0 commit comments

Comments
 (0)