This commit is contained in:
vxunderground 2021-06-03 19:08:27 -05:00 зафіксовано GitHub
джерело 6959eb869c
коміт 3ff92cdc46
Не вдалося знайти GPG ключ що відповідає даному підпису
Ідентифікатор GPG ключа: 4AEE18F83AFDEB23

@ -1,17 +1,25 @@
#include <windows.h>
/*
DEFINITIONS FOR TEB MUST BE PRESENT
SetLastErrorAlt function
Summary:
Custom implementation of SetLastError. Relevant for malware dev, eliminates the need to dynamically resolve SeyLastError from kernel32.dll
Parameters:
DWORD ErrorCode
The last-error code for the thread.
Return value:
N/A
Remarks:
TEB and GetPeb must be defined.
Author:
smelly__vx | June 3rd, 2021
*/
PTEB GetTeb(VOID)
{
#if defined(_WIN64)
return (PTEB)__readgsqword(0x30);
#elif define(_WIN32)
return (PTEB)__readfsdword(0x18);
#endif
}
VOID SetLastErrorAlt(DWORD ErrorCode)
{
@ -19,12 +27,3 @@ VOID SetLastErrorAlt(DWORD ErrorCode)
Teb->LastErrorValue = ErrorCode;
return;
}
INT main(VOID)
{
DWORD dwError = 1;
SetLastErrorAlt(1);
return ERROR_SUCCESS;
}