-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
677 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
; _TCSEXT.ASM-- | ||
; | ||
; Copyright (c) The Asmc Contributors. All rights reserved. | ||
; Consult your license regarding permissions and restrictions. | ||
; | ||
; char *strext(char *); | ||
; wchar_t *_wstrext(wchar_t *); | ||
; | ||
|
||
_tcsext proc uses rbx string:LPTSTR | ||
|
||
ldr rcx,string | ||
|
||
mov rbx,_tcsfn( rcx ) | ||
|
||
.if _tcsrchr( rbx, '.' ) | ||
|
||
.if ( rax == rbx ) | ||
|
||
xor eax,eax | ||
.endif | ||
.endif | ||
ret | ||
|
||
_tcsext endp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
; _TCSFCAT.ASM-- | ||
; | ||
; Copyright (c) The Asmc Contributors. All rights reserved. | ||
; Consult your license regarding permissions and restrictions. | ||
; | ||
; char *strfcat(char *, char *, char *); | ||
; wchar_t *_wstrfcat(wchar_t *, wchar_t *, wchar_t *); | ||
; | ||
|
||
_tcsfcat proc uses rsi rdi rbx buffer:LPTSTR, path:LPTSTR, file:LPTSTR | ||
|
||
ldr rsi,path | ||
ldr rbx,file | ||
ldr rdx,buffer | ||
|
||
xor eax,eax | ||
mov ecx,-1 | ||
|
||
.if ( rsi ) | ||
|
||
mov rdi,rsi ; overwrite buffer | ||
repne _tscasb | ||
mov rdi,rdx | ||
not ecx | ||
rep _tmovsb | ||
.else | ||
mov rdi,rdx ; length of buffer | ||
repne _tscasb | ||
.endif | ||
sub rdi,TCHAR | ||
|
||
.if ( rdi != rdx ) ; add slash if missing | ||
|
||
movzx eax,TCHAR ptr [rdi-TCHAR] | ||
ifdef __UNIX__ | ||
.if ( eax != '/' ) | ||
|
||
mov eax,'/' | ||
else | ||
.if ( !( eax == '\' || eax == '/' ) ) | ||
|
||
mov eax,'\' | ||
endif | ||
_tstosb | ||
.endif | ||
.endif | ||
|
||
mov rsi,rbx ; add file name | ||
.repeat | ||
_tlodsb | ||
_tstosb | ||
.until !eax | ||
.return(rdx) | ||
|
||
_tcsfcat endp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
; _TCSFN.ASM-- | ||
; | ||
; Copyright (c) The Asmc Contributors. All rights reserved. | ||
; Consult your license regarding permissions and restrictions. | ||
; | ||
; char *strfn(char *path); | ||
; wchar_t *_wstrfn(wchar_t *path); | ||
; | ||
; return file part of path if /\ is found, else path | ||
; | ||
|
||
_tcsfn proc path:LPTSTR | ||
|
||
ldr rcx,path | ||
movzx edx,TCHAR ptr [rcx] | ||
|
||
.for ( rax = rcx : edx : ) | ||
ifdef __UNIX__ | ||
.if ( edx == '/' ) | ||
else | ||
.if ( edx == '\' || edx == '/' ) | ||
endif | ||
.if ( TCHAR ptr [rcx+TCHAR] ) | ||
|
||
lea rax,[rcx+TCHAR] | ||
.endif | ||
.endif | ||
add rcx,TCHAR | ||
movzx edx,TCHAR ptr [rcx] | ||
.endf | ||
ret | ||
|
||
_tcsfn endp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
; _TCSFXCAT.ASM-- | ||
; | ||
; Copyright (c) The Asmc Contributors. All rights reserved. | ||
; Consult your license regarding permissions and restrictions. | ||
; | ||
; char *strfxcat(char *, char *); | ||
; wchar_t *_wstrfxcat(wchar_t *, wchar_t *); | ||
; | ||
|
||
_tcsfxcat proc path:LPTSTR, ext:LPTSTR | ||
|
||
.if _tcsext(path) | ||
|
||
mov TCHAR ptr [rax],0 | ||
.endif | ||
_tcscat(path, ext) | ||
ret | ||
|
||
_tcsfxcat endp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
; _TCSTRIM.ASM-- | ||
; | ||
; Copyright (c) The Asmc Contributors. All rights reserved. | ||
; Consult your license regarding permissions and restrictions. | ||
; | ||
; int strtrim(char *); | ||
; int _wstrtrim(wchar_t *); | ||
; | ||
; Return EAX char count, RCX string, and edx last char | ||
; | ||
|
||
_tcstrim proc uses rdi rbx string:LPTSTR | ||
|
||
ldr rbx,string | ||
|
||
.for ( rdi = &[rbx+_tcslen(rbx)*TCHAR-TCHAR], rcx = _pctype : eax : eax--, rdi-=TCHAR ) | ||
|
||
movzx edx,TCHAR ptr [rdi] | ||
ifdef _UNICODE | ||
.break .if ( edx > ' ' ) | ||
endif | ||
.break .if !( byte ptr [rcx+rdx*2] & _SPACE ) | ||
mov TCHAR ptr [rdi],0 | ||
.endf | ||
mov rcx,rbx | ||
ret | ||
|
||
_tcstrim endp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
; FILE.ASM-- | ||
; | ||
; Copyright (c) The Asmc Contributors. All rights reserved. | ||
; Consult your license regarding permissions and restrictions. | ||
; | ||
|
||
include io.inc | ||
include fcntl.inc | ||
include stdio.inc | ||
include winbase.inc | ||
include tchar.inc | ||
|
||
.code | ||
|
||
_tmain proc argc:int_t, argv:array_t | ||
|
||
.new fname[ 256]:TCHAR | ||
.new finfo[1024]:TCHAR | ||
|
||
.if ( ecx != 2 ) ; argc | ||
|
||
_tprintf( "Usage: FILE <name>[.exe]\n\n" ) | ||
.return( 1 ) | ||
.endif | ||
|
||
mov rdi,[rdx+size_t] ; argv[1] | ||
.ifd ( SearchPath( ".", rdi, ".exe", 256, &fname, NULL ) == 0 ) | ||
|
||
SearchPath( NULL, rdi, ".exe", 256, &fname, NULL ) | ||
.endif | ||
|
||
.if ( eax == 0 ) | ||
|
||
_tprintf( "File not found: %s\n", rdi ) | ||
.return( 1 ) | ||
.endif | ||
|
||
lea rdi,fname | ||
.ifd ( _topen( rdi, O_RDONLY or O_BINARY, 0 ) == -1 ) | ||
|
||
_tperror(rdi) | ||
.return( 1 ) | ||
.endif | ||
|
||
mov ebx,eax | ||
lea rsi,finfo | ||
|
||
_read( ebx, rsi, 1024 ) | ||
_close( ebx ) | ||
_tprintf( "\n%s:\n Machine:", rdi ) | ||
|
||
mov eax,[rsi].IMAGE_DOS_HEADER.e_lfanew | ||
add rsi,rax | ||
|
||
.if ( [rsi].IMAGE_NT_HEADERS.FileHeader.Machine == IMAGE_FILE_MACHINE_I386 ) | ||
|
||
_tprintf( "\tI386\n ImageBase:\t%08X\n", [rsi].IMAGE_NT_HEADERS32.OptionalHeader.ImageBase ) | ||
.return( 0 ) | ||
.endif | ||
|
||
_tprintf( "\t\tAMD64\n ImageBase:\t\t%016llX\n", [rsi].IMAGE_NT_HEADERS64.OptionalHeader.ImageBase ) | ||
|
||
lea rdi,@CStr( "No" ) | ||
lea rbx,@CStr( "Yes" ) | ||
mov rax,rdi | ||
.if ( [rsi].IMAGE_NT_HEADERS64.FileHeader.Characteristics & IMAGE_FILE_LARGE_ADDRESS_AWARE ) | ||
mov rax,rbx | ||
.endif | ||
_tprintf( " Large address aware:\t%s\n", rax ) | ||
|
||
movzx esi,[rsi].IMAGE_NT_HEADERS64.OptionalHeader.DllCharacteristics | ||
mov rax,rdi | ||
.if ( esi & IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE ) | ||
mov rax,rbx | ||
.endif | ||
_tprintf( " ASLR:\t\t\t%s\t/DYNAMICBASE\n", rax ) | ||
|
||
mov rax,rdi | ||
.if ( esi & IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA ) | ||
mov rax,rbx | ||
.endif | ||
_tprintf( " ASLR^2:\t\t%s\t/HIGHENTROPYVA\n", rax ) | ||
|
||
mov rax,rdi | ||
.if ( esi & IMAGE_DLLCHARACTERISTICS_NX_COMPAT ) | ||
mov rax,rbx | ||
.endif | ||
_tprintf( " DEP:\t\t\t%s\t/NXCOMPAT\n", rax ) | ||
|
||
mov rax,rdi | ||
.if ( esi & IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE ) | ||
mov rax,rbx | ||
.endif | ||
_tprintf( " TS Aware:\t\t%s\t/GS\n\n", rax ) | ||
.return( 0 ) | ||
|
||
_tmain endp | ||
|
||
end _tstart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup Label="ProjectConfigurations"> | ||
<ProjectConfiguration Include="Debug|X64"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>X64</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Debug|win32"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>win32</Platform> | ||
</ProjectConfiguration> | ||
</ItemGroup> | ||
<PropertyGroup Label="Globals"> | ||
<AsmcDir>$(AsmcDir)</AsmcDir> | ||
<RootNamespace>file</RootNamespace> | ||
<VCProjectVersion>16.0</VCProjectVersion> | ||
<Keyword>Win32Proj</Keyword> | ||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.Default.props" /> | ||
<PropertyGroup Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>true</UseDebugLibraries> | ||
<PlatformToolset>v143</PlatformToolset> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.props" /> | ||
<ImportGroup Label="ExtensionSettings"> | ||
<Import Project="$(AsmcDir)\bin\asmc.props" /> | ||
</ImportGroup> | ||
<ImportGroup Label="Shared"> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets"> | ||
<Import Project="$(UserRootDir)Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<PropertyGroup Label="UserMacros" /> | ||
<PropertyGroup> | ||
<LinkIncremental>true</LinkIncremental> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'"> | ||
<Link> | ||
<SubSystem>Console</SubSystem> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<GenerateMapFile>true</GenerateMapFile> | ||
<TargetMachine>MachineX64</TargetMachine> | ||
<AdditionalLibraryDirectories>$(AsmcDir)\lib\X64</AdditionalLibraryDirectories> | ||
<AdditionalOptions>/merge:.CRT=.rdata %(AdditionalOptions)</AdditionalOptions> | ||
</Link> | ||
<ASMC> | ||
<UnicodeCharacterSet>false</UnicodeCharacterSet> | ||
<GenerateUnwindInformation>true</GenerateUnwindInformation> | ||
<GenerateCStackFrame>true</GenerateCStackFrame> | ||
</ASMC> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|win32'"> | ||
<Link> | ||
<SubSystem>Console</SubSystem> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<GenerateMapFile>true</GenerateMapFile> | ||
<AdditionalLibraryDirectories>$(AsmcDir)\lib\x86</AdditionalLibraryDirectories> | ||
<AdditionalOptions>/merge:.CRT=.rdata %(AdditionalOptions)</AdditionalOptions> | ||
</Link> | ||
<ASMC> | ||
<UnicodeCharacterSet>false</UnicodeCharacterSet> | ||
<GenerateCStackFrame>true</GenerateCStackFrame> | ||
<ObjectFileTypeCOFF>true</ObjectFileTypeCOFF> | ||
</ASMC> | ||
</ItemDefinitionGroup> | ||
<ItemGroup> | ||
<ASMC Include="file.asm" /> | ||
</ItemGroup> | ||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.targets" /> | ||
<ImportGroup Label="ExtensionTargets"> | ||
<Import Project="$(AsmcDir)\bin\asmc.targets" /> | ||
</ImportGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Makefile for file | ||
# Mon Oct 21 19:18:15 2024 | ||
|
||
flags = -q -pe | ||
|
||
file: | ||
asmc64 $(flags) $@.asm | ||
$@ | ||
@pause | ||
|
||
clean: | ||
del file.exe |
Oops, something went wrong.