Skip to content
This repository has been archived by the owner on Jul 13, 2020. It is now read-only.

Commit

Permalink
v1.0.0.13
Browse files Browse the repository at this point in the history
- Added console and log information for info, status or error (if started via command line)
  • Loading branch information
mrfearless committed Feb 23, 2019
1 parent 3c27eca commit b4f8a74
Show file tree
Hide file tree
Showing 11 changed files with 383 additions and 118 deletions.
281 changes: 252 additions & 29 deletions EEex/EEex.asm

Large diffs are not rendered by default.

Binary file modified EEex/EEex.exe
Binary file not shown.
38 changes: 26 additions & 12 deletions EEex/EEex.inc
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ ProcessCmdLine PROTO
WinMain PROTO :DWORD, :DWORD, :DWORD, :DWORD
EnumWindowsProc PROTO :DWORD, :DWORD
CheckFileVersion PROTO :DWORD, :DWORD
DisplayErrorMessage PROTO :DWORD, :DWORD
InjectDLL PROTO :DWORD, :DWORD

DisplayErrorMessage PROTO :DWORD, :DWORD
LogMessage PROTO :DWORD


IFNDEF LANGANDCODEPAGE
LANGANDCODEPAGE STRUCT
wLanguage DW ?
Expand All @@ -40,7 +43,14 @@ EEEX_ALIGN TEXTEQU <ALIGN 16>
; EEex Initialized Data
;------------------------------------------------------------------------------
AppName DB "EEex loader",0
szAppName DB "[EEex loader]",0
szAppVersion DB " v1.0.0.13",0
szEEexLoaderByfearless DB "EEex loader by fearless: github.com/mrfearless/EEexLoader",0
szEEexByBubb DB "EEex by Bubb: github.com/Bubb13/EEex",0
szCRLF DB 13,10,0
szInfoEntry DB "[*] ",0
szStatusEntry DB "[-] ",0
szErrorEntry DB "[!] ",0

; Beamdog EE game executables:
szBeamdog_BGEE DB "Baldur.exe",0
Expand Down Expand Up @@ -76,7 +86,7 @@ szFormatErrorMessage DB 'Error: ', '%s', 0

; EE Game Locate And Execute Error Messages:
szErrorEEGameRunning DB "A Beamdog Enhanced Edition game is already running, please close it before launching EEex.",0
szErrorEEGameExecute DB "CreateProcess failed to execute Beamdog Enhanced Edition game executable.",0
szErrorEEGameExecute DB "CreateProcess failed to execute Beamdog Enhanced Edition game executable. ",0
szErrorEEGameEXE DB "Failed to locate a Beamdog Enhanced Edition game executable.",0
szErrorEEexDLLFind DB "Failed to locate EEex.dll. Make sure it is located in the game folder along with EEex.exe",0
szErrorEEOverrideFiles DB "One of more override files appear to be missing: UI.menu, TRIGGER.ids, OBJECT.ids and ACTION.ids",0
Expand All @@ -99,15 +109,19 @@ szErrorHeap DB "CheckFileVersion: GetProcessHeap failed.",0
szErrorHeapAlloc DB "CheckFileVersion: HeapAlloc failed.",0

; InjectDLL Error Messages:
szErrorVirtualAllocEx DB "InjectDLL: VirtualAllocEx failed.",0
szErrorWriteProcessMem DB "InjectDLL: WriteProcessMemory failed.",0
szErrorGetModuleHandle DB "InjectDLL: GetModuleHandle failed.",0
szErrorGetProcAddress DB "InjectDLL: GetProcAddress failed.",0
szErrorRemoteThread DB "InjectDLL: CreateRemoteThread failed.", 0
szErrorWaitSingleObj DB "InjectDLL: WaitForSingleObject failed.",0
szErrorWaitSingleInv DB "InjectDLL: WaitForSingleObject returned invalid value.",0
szErrorExitCodeThread DB "InjectDLL: GetExitCodeThread failed.",0
szErrorThreadActive DB "InjectDLL: hRemoteThread still active.",0
szErrorVirtualAllocEx DB "InjectDLL: VirtualAllocEx failed. ",0
szErrorWriteProcessMem DB "InjectDLL: WriteProcessMemory failed. ",0
szErrorGetModuleHandle DB "InjectDLL: GetModuleHandle failed. ",0
szErrorGetProcAddress DB "InjectDLL: GetProcAddress failed. ",0
szErrorRemoteThread DB "InjectDLL: CreateRemoteThread failed. ", 0
szErrorWaitSingleObj DB "InjectDLL: WaitForSingleObject failed. ",0
szErrorWaitSingleInv DB "InjectDLL: WaitForSingleObject returned invalid value. ",0
szErrorExitCodeThread DB "InjectDLL: GetExitCodeThread failed. ",0
szErrorThreadActive DB "InjectDLL: hRemoteThread still active. ",0

szStatusLaunchingEEGame DB "Launching EE game executable: ",0
szStatusInjectingDLL DB "Injecting EEex.dll into EE game executable.",0
szStatusRedirectCon DB "Redirecting console output of EE game executable: ",0

szCurrentFolder DB MAX_PATH DUP (0)
szEEGameEXE DB MAX_PATH DUP (0)
Expand Down Expand Up @@ -138,5 +152,5 @@ startinfo STARTUPINFO <>
pi PROCESS_INFORMATION <>
wfd WIN32_FIND_DATA <>
ExitCode DD ?

hConOutput DD ?

43 changes: 22 additions & 21 deletions EEex/EEex.rap
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,20 @@ Menu=1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0
[VerInf]
Nme=VERINF1
ID=1
FV=1.0.0.12
PV=1.0.0.12
FV=1.0.0.13
PV=1.0.0.13
VerOS=0x00000004
VerFT=0x00000001
VerLNG=0x00000409
VerCHS=0x000004B0
ProductVersion=1.0.0.12
ProductVersion=1.0.0.13
ProductName=EEex.exe
OriginalFilename=EEex.exe
LegalTrademarks=fearless
LegalCopyright=fearless
InternalName=EEex.exe
FileDescription=EEex loader
FileVersion=1.0.0.12
FileVersion=1.0.0.13
CompanyName=fearless
[Group]
Group=Assembly,Resources,Misc
Expand All @@ -80,34 +80,35 @@ Group=Assembly,Resources,Misc
4=2
5=1
[AutoLoad]
AutoLoad=2,1,4,3
AutoLoad=2,1,4,3,5
[RADebugBP]
2=
1=
3=
5=
[Find]
1="NtWVM"
2="szFileVersion"
3="lpFileVerInfo"
4=";-------------------------------------------------------------------------------------"
5=";-----------------------------------------------------------------------------------------"
6="dwFileVerInfoSize"
7="szFilename"
8="lpdwHandle"
9="nbytes"
10="szLang"
1="szErrorBeamdog_BGEE"
2="szStatusEntry"
3="szEntry"
4="ConsoleStdOut"
5="NtWVM"
6="szFileVersion"
7="lpFileVerInfo"
8=";-------------------------------------------------------------------------------------"
9=";-----------------------------------------------------------------------------------------"
10="dwFileVerInfoSize"
[Size]
4=0,0,0,0,0
5=
5=0,0,0,0,3925
3=0,0,0,0,19
1=0,0,0,0,28587
2=0,0,0,0,5499
1=0,0,0,0,4139
2=0,0,0,0,1547
[Collapse]
3=
1=1342705312,16,
1=1115685378,,4194304
2=
4=
5=808288
[VersionControl]
Settings=1279
Milestones=129
Expand All @@ -118,7 +119,7 @@ MilestoneOnTime=2
MilestoneOnDate=0
MilestoneOnDateWhen=1
MilestoneOnDateStatus=0
MilestoneOnDateDate=22
MilestoneOnDateDate=23
MilestoneOnDateTimeYear=2019
MilestoneOnDateTimeMonth=1
MilestoneOnDateTimeDate=26
Expand All @@ -142,7 +143,7 @@ ProductVer2Range=0
ProductVer3Range=0
ProductVer4Range=0
[PTimer]
PTimer=43121702
PTimer=51289025
[GroupExpand]
GroupExpand=1,0,1,0
[BookMark]
Expand Down
61 changes: 28 additions & 33 deletions EEex/EEexConsole.asm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ GetCommandLine EQU <GetCommandLineA>
ConsoleParseCmdLine PROTO :DWORD
ConsoleCmdLineParam PROTO :DWORD,:DWORD,:DWORD,:DWORD
ConsoleClearScreen PROTO
ConsoleStdOut PROTO :DWORD
ConsoleText PROTO :DWORD
ConsoleStarted PROTO
ConsoleAttach PROTO
ConsoleSendEnterKey PROTO
Expand Down Expand Up @@ -149,51 +149,46 @@ ConsoleCmdLineParam endp

EEEX_ALIGN
;------------------------------------------------------------------------------
; ConsoleStdOut
; ConsoleText
;------------------------------------------------------------------------------
ConsoleStdOut PROC lpszConText:DWORD
LOCAL hConOutput:DWORD
ConsoleText PROC lpszConText:DWORD
LOCAL dwBytesWritten:DWORD
LOCAL dwLenConText:DWORD
LOCAL dwBytesToWrite:DWORD

Invoke GetStdHandle, STD_OUTPUT_HANDLE
mov hConOutput, eax

Invoke lstrlen, lpszConText
mov dwLenConText, eax

Invoke WriteFile, hConOutput, lpszConText, dwLenConText, Addr dwBytesWritten, NULL

mov eax, dwBytesWritten
.IF hConOutput != 0 && lpszConText != 0
Invoke lstrlen, lpszConText
mov dwBytesToWrite, eax
Invoke WriteFile, hConOutput, lpszConText, dwBytesToWrite, Addr dwBytesWritten, NULL
mov eax, dwBytesWritten
.ELSE
xor eax, eax
.ENDIF
ret
ConsoleStdOut ENDP
ConsoleText ENDP

EEEX_ALIGN
;------------------------------------------------------------------------------
; ClearConsoleScreen
;------------------------------------------------------------------------------
ConsoleClearScreen PROC USES EBX
LOCAL hConOutput:DWORD
LOCAL noc:DWORD
LOCAL cnt:DWORD
LOCAL sbi:CONSOLE_SCREEN_BUFFER_INFO

Invoke GetStdHandle, STD_OUTPUT_HANDLE
mov hConOutput, eax

Invoke GetConsoleScreenBufferInfo, hConOutput, Addr sbi
mov eax, sbi.dwSize ; 2 word values returned for screen size

; extract the 2 values and multiply them together
mov ebx, eax
shr eax, 16
mul bx
mov cnt, eax

Invoke FillConsoleOutputCharacter, hConOutput, 32, cnt, NULL, Addr noc
movzx ebx, sbi.wAttributes
Invoke FillConsoleOutputAttribute, hConOutput, ebx, cnt, NULL, Addr noc
Invoke SetConsoleCursorPosition, hConOutput, NULL
.IF hConOutput != 0
Invoke GetConsoleScreenBufferInfo, hConOutput, Addr sbi
mov eax, sbi.dwSize ; 2 word values returned for screen size
; extract the 2 values and multiply them together
mov ebx, eax
shr eax, 16
mul bx
mov cnt, eax
Invoke FillConsoleOutputCharacter, hConOutput, 32, cnt, NULL, Addr noc
movzx ebx, sbi.wAttributes
Invoke FillConsoleOutputAttribute, hConOutput, ebx, cnt, NULL, Addr noc
Invoke SetConsoleCursorPosition, hConOutput, NULL
.ENDIF
ret
ConsoleClearScreen ENDP

Expand Down
8 changes: 4 additions & 4 deletions EEex/Res/EEexVer.rc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define VERINF1 1
VERINF1 VERSIONINFO
FILEVERSION 1,0,0,12
PRODUCTVERSION 1,0,0,12
FILEVERSION 1,0,0,13
PRODUCTVERSION 1,0,0,13
FILEOS 0x00000004
FILETYPE 0x00000001
BEGIN
Expand All @@ -10,14 +10,14 @@ BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "fearless\0"
VALUE "FileVersion", "1.0.0.12\0"
VALUE "FileVersion", "1.0.0.13\0"
VALUE "FileDescription", "EEex loader\0"
VALUE "InternalName", "EEex.exe\0"
VALUE "LegalCopyright", "fearless\0"
VALUE "LegalTrademarks", "fearless\0"
VALUE "OriginalFilename", "EEex.exe\0"
VALUE "ProductName", "EEex.exe\0"
VALUE "ProductVersion", "1.0.0.12\0"
VALUE "ProductVersion", "1.0.0.13\0"
END
END
BLOCK "VarFileInfo"
Expand Down
20 changes: 10 additions & 10 deletions EEexDLL/EEex.rap
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ MilestoneOnTime=2
MilestoneOnDate=0
MilestoneOnDateWhen=1
MilestoneOnDateStatus=0
MilestoneOnDateDate=22
MilestoneOnDateDate=23
MilestoneOnDateTimeYear=2019
MilestoneOnDateTimeMonth=1
MilestoneOnDateTimeDate=26
Expand All @@ -106,7 +106,7 @@ ProductVer2Range=0
ProductVer3Range=0
ProductVer4Range=0
[PTimer]
PTimer=422028986
PTimer=429163864
[GroupExpand]
GroupExpand=1,1,0
[BookMark]
Expand Down Expand Up @@ -137,20 +137,20 @@ GroupExpand=1,1,0
[VerInf]
Nme=VERINF1
ID=1
FV=1.0.0.12
PV=1.0.0.12
FV=1.0.0.13
PV=1.0.0.13
VerOS=0x00000004
VerFT=0x00000002
VerLNG=0x00000409
VerCHS=0x000004B0
ProductVersion=1.0.0.12
ProductVersion=1.0.0.13
ProductName=EEex.dll
OriginalFilename=EEex.dll
LegalTrademarks=fearless
LegalCopyright=fearless
InternalName=EEex.dll
FileDescription=EEex.dll
FileVersion=1.0.0.12
FileVersion=1.0.0.13
CompanyName=fearless
[Collapse]
3=
Expand All @@ -159,9 +159,9 @@ CompanyName=fearless
1=17297534,134773776,6291456,4194331,152,16793606,458752,1280
6=815132086,266
2=
7=75628616,
7=75497544,
8=
9=536941056,
9=1090661895,
10=
11=
[Size]
Expand All @@ -171,9 +171,9 @@ CompanyName=fearless
1=0,0,1248,579,400
6=0,0,0,0,18687
2=0,0,0,0,623
7=0,0,0,0,3788
7=0,0,0,0,10336
8=0,0,0,0,65567
9=0,0,0,0,17159
9=0,0,0,0,1663
10=0,0,1248,579,9103
11=0,0,0,0,687
[Find]
Expand Down

0 comments on commit b4f8a74

Please sign in to comment.