Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
x64/Debug/VX-API.exe
*.pdb
.vs/VX-API/v17/.suo
.vs/VX-API/v17/DocumentLayout*
*.vsidx
*.db
*.db-shm
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ You're free to use this in any manner you please. You do not need to use this en
| Function Name | Original Author |
| ------------- | --------------- |
| GetLastErrorFromTeb | smelly__vx |
| GetLastErrorFromOffset | d4ytox |
| GetLastNtStatusFromTeb | smelly__vx |
| RtlNtStatusToDosErrorViaImport | ReactOS |
| GetLastErrorFromTeb | smelly__vx |
Expand Down
10 changes: 10 additions & 0 deletions VX-API/GetLastErrorFromOffset.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "Win32Helper.h"

DWORD GetLastErrorFromOffset(VOID)
{
#ifdef _WIN64
return (DWORD)__readgsqword(0x68);
#else
return __readfsdword(0x34);
#endif
}
1 change: 1 addition & 0 deletions VX-API/VX-API.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
<ClCompile Include="FastcallExecuteBinaryShellExecuteEx.cpp" />
<ClCompile Include="GetCurrentProcessNoForward.cpp" />
<ClCompile Include="GetCurrentThreadNoForward.cpp" />
<ClCompile Include="GetLastErrorFromOffset.cpp" />
<ClCompile Include="GetPeSectionSizeInBytes.cpp" />
<ClCompile Include="IeCreateDirectory.cpp" />
<ClCompile Include="IeCreateFile.cpp" />
Expand Down
3 changes: 3 additions & 0 deletions VX-API/VX-API.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,9 @@
<ClCompile Include="IeRemoveDirectory.cpp">
<Filter>Source Files\Proxied Functions</Filter>
</ClCompile>
<ClCompile Include="GetLastErrorFromOffset.cpp">
<Filter>Source Files\Error Handling</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Internal.h">
Expand Down
1 change: 1 addition & 0 deletions VX-API/Win32Helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ BOOL ExtractFilesFromCabIntoTargetA(LPCSTR CabFile, LPCSTR OutputDirectory);
ERROR HANDLING
*******************************************/
DWORD GetLastErrorFromTeb(VOID);
DWORD GetLastErrorFromOffset(VOID);
NTSTATUS GetLastNtStatusFromTeb(VOID);
VOID SetLastErrorInTeb(_In_ DWORD ErrorCode);
VOID SetLastNtStatusInTeb(_In_ NTSTATUS Status);
Expand Down