Skip to content

Instantly share code, notes, and snippets.

@juntalis
Last active September 27, 2015 16:12
Show Gist options
  • Select an option

  • Save juntalis/cdc4bb86836ddc19bcbb to your computer and use it in GitHub Desktop.

Select an option

Save juntalis/cdc4bb86836ddc19bcbb to your computer and use it in GitHub Desktop.
Not-quite-compatible implementation of NASM's __utf16__ keyword for YASM.
BITS 32
%macro __utf16__ 1
%assign idx 1
%xdefine wstring
%xdefine cstring %1
%strlen cstrlen cstring
%rep cstrlen
%substr cchar cstring idx
%if idx = 1
%xdefine wstring cchar, 0x0
%elif idx = cstrlen
%xdefine wstring wstring cchar, 0x0
%else
%xdefine wstring wstring cchar, 0x0,
%endif
%assign idx idx+1
%endrep
db wstring
%endmacro
%define u(S) __utf16__ S
main:
pushf
pusha
xor eax, eax
add eax, wsDllPath - $
ret
wsDllPath:
u('injected_dll')
dw 0x0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment