This quick code checks if your computer is a member of a domain :
include IsDomainMemb.inc
.data
m1 db 'The computer is not joined to a domain.',0
m2 db 'The computer is joined to a domain.',0
tbl dd OFFSET m1,OFFSET m2
.code
start:
invoke IsOS,OS_DOMAINMEMBER
xor ecx,ecx
test eax,eax
setne cl
push ecx
shl ecx,2
lea edx,[tbl+ecx]
invoke StdOut,DWORD PTR [edx]
pop eax
invoke ExitProcess,eax
Hi Vortex,
Although I wrote some programs in pure assembly language in 1992, it is not my area of expertise. Nevertheless, I would like to thank you for consistently providing new examples.
Marco
Hello,
Here is the 64-bit version :
OS_DOMAINMEMBER equ 28
ExitProcess PROTO :QWORD
IsOS PROTO :QWORD
printf PROTO :QWORD,:VARARG
.data
m1 db 'The computer is not joined to a domain.',0
m2 db 'The computer is joined to a domain.',0
tbl dq OFFSET m1,OFFSET m2
.data?
rv dq ?
.code
start:
sub rsp,4*8+8
invoke IsOS,OS_DOMAINMEMBER
xor rdx,rdx
test rax,rax
setne dl
mov rv,rdx
shl rdx,3
lea rax,[tbl+rdx]
invoke printf,QWORD PTR [rax]
invoke ExitProcess,rv
END start
A similar C version
Have to test this part:---
char *fmt = "The computer is%s joined to a domain.\n";
char *not[] = {" not", ""};
...
printf(fmt, not[rc]);
Hi Timo,
Thanks, your code works as expected.
Inspired by the thread :
https://masm32.com/board/index.php?topic=13433.0
include CheckOS.inc
.data
m1 db 'The application is native 32-bit app on a 32-bit OS or a native 64-bit app on a 64-bit OS.',0
m2 db 'The application is running via the WOW64 translation layer.',0
tbl dd OFFSET m1,OFFSET m2
.code
start:
invoke IsOS,OS_WOW6432
xor ecx,ecx
test eax,eax
setne cl
push ecx
shl ecx,2
lea edx,[tbl+ecx]
invoke StdOut,DWORD PTR [edx]
pop eax
invoke ExitProcess,eax
OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE