SysWhispers3 icon indicating copy to clipboard operation
SysWhispers3 copied to clipboard

Improvement suggestions

Open Mecanik opened this issue 2 years ago • 2 comments

Hi,

Please consider the following improvements:

  1. If one does not use anything else but these definitions, NTSTATUS will be missing, you can just add:
#ifndef SW3_HEADER_H_
#define SW3_HEADER_H_

#include <windows.h>

#ifndef _NTDEF_
typedef _Return_type_success_(return >= 0) LONG NTSTATUS;
typedef NTSTATUS* PNTSTATUS;
#endif
  1. If one needs to use another definition set like phnt, the definitions will clash at compile time. My suggestion is to rename the structures/definitions with a prefix like:
typedef struct _SW3_SYSTEM_HANDLE
{
	ULONG ProcessId;
	BYTE ObjectTypeNumber;
	BYTE Flags;
	USHORT Handle;
	PVOID Object;
	ACCESS_MASK GrantedAccess;
} SW3_SYSTEM_HANDLE, *PSW3SYSTEM_HANDLE;

Same for functions (there is no reason we cannot name them as we wish):

EXTERN_C NTSTATUS Sw3NtCreateProcess(
	OUT PHANDLE ProcessHandle,
	IN ACCESS_MASK DesiredAccess,
	IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
	IN HANDLE ParentProcess,
	IN BOOLEAN InheritObjectTable,
	IN HANDLE SectionHandle OPTIONAL,
	IN HANDLE DebugPort OPTIONAL,
	IN HANDLE ExceptionPort OPTIONAL);

This would prevent the "already defined" compiling issue. Perhaps add a flag like --custom-prefix which would prefix the functions/structured/definitions as the user specifies.

  1. Instead of the current initial see, you might want to consider using xoshiro prng.

Thanks!

Mecanik avatar Dec 15 '23 09:12 Mecanik

These are great suggestions! I'll take a good look and try to integrate them asap! Thanks a lot! Moreover, if you feel like connecting, feel free to join the new dedicated Discord server! https://discord.gg/FpXpdg7Z

klezVirus avatar Dec 15 '23 10:12 klezVirus

I've started working on the suggestions. Should have handled everything except xorshiro yet, if you can give it a test it would be super!

klezVirus avatar Dec 19 '23 00:12 klezVirus