Recent Posts

Pages: [1] 2 3 ... 10
1
Code: [Select]
MOV RCX,pAdapter
MOV R10, RCX
MOV R10,[R10] 
CALL QWORD PTR [R10+16]
2
The Campus / MOVED: My own bootloader
« Last post by hutch-- on Today at 01:46:59 AM »
3
16 bit DOS Programming / My own bootloader
« Last post by Hercules on Today at 01:43:03 AM »
I write my own bootloader but system don't bootstrap when run my code:

Code: [Select]
mov ah,2
mov al,1
mov bx,addr MBR
mov cx,1
mov dx,80h
int 13h
mov ah,3
mov al,1
mov cx,7
int 13h
mov cx,1fdh
mov si,addr code
mov di,addr MBR
rep movsb
mov ah,3
mov al,1
mov bx,addr MBR
mov cx,1
mov dx,80h
int 13h
ret
mov ax,201h
mov bx,7c00h
mov cx,7
mov dx,80h
INT 13h
db 0EAh
dw 007Ch
dw 0000
Why system dont bootstrap after the code?
4
UASM Assembler Development / How to release the COM interfaces (64-bit)?
« Last post by aw27 on Today at 12:49:14 AM »
I know how to make it work, but am testing the UASM facilities.
In the code below pAdapter->Release() and pOutput->Release() are not accepted.
I can not add Release, QueryInterface and AddRef to the interface because it complains.
Using _VCOMINVOKE appears to be a black art  :dazzled: , I can't make it work at all (no examples also).

Code: [Select]
OPTION LITERALS:ON

HRESULT TYPEDEF DWORD
HWND TYPEDEF PTR
HMODULE TYPEDEF PTR
LPVOID TYPEDEF PTR VOID

includelib \masm32\lib64\msvcrt.lib
printf PROTO :PTR, :VARARG
wprintf PROTO :PTR, :VARARG
memset PROTO :ptr, :dword, :qword
includelib \masm32\lib64\kernel32.lib
LoadLibraryA PROTO :PTR
GetProcAddress PROTO :HMODULE, :PTR
FreeLibrary PROTO :HMODULE
ExitProcess PROTO :DWORD

CreateDXGIFactory TYPEDEF PROTO :ptr, :ptr

PIDXGIFactory TYPEDEF PTR IDXGIFactory
COMINTERFACE IDXGIFactory
CVIRTUAL SetPrivateData, DWORD, :PTR, :DWORD, :PTR
CVIRTUAL SetPrivateDataInterface, DWORD, :PTR, :PTR
CVIRTUAL GetPrivateData, DWORD, :PTR, :PTR, :PTR
CVIRTUAL GetParent, DWORD, :PTR, :PTR
CVIRTUAL EnumAdapters,DWORD, :DWORD, :PTR
CVIRTUAL MakeWindowAssociation,DWORD, :HWND, :DWORD
CVIRTUAL GetWindowAssociation, DWORD, :PTR
CVIRTUAL CreateSwapChain, DWORD, :PTR, : PTR, :PTR
CVIRTUAL CreateSoftwareAdapter, DWORD, :HMODULE, :PTR
ENDCOMINTERFACE

PIDXGIAdapter TYPEDEF PTR IDXGIAdapter
COMINTERFACE IDXGIAdapter
CVIRTUAL SetPrivateData, DWORD, :PTR, :PTR, :DWORD, :PTR
CVIRTUAL SetPrivateDataInterface, DWORD, :PTR, :PTR, :PTR
CVIRTUAL GetPrivateData, DWORD, :PTR, :PTR, :PTR, :PTR
CVIRTUAL GetParent, DWORD, :PTR, :PTR, :PTR

CVIRTUAL EnumOutputs, DWORD, :DWORD, :PTR
CVIRTUAL GetDesc, DWORD, :PTR
CVIRTUAL CheckInterfaceSupport, DWORD, :PTR, :PTR
ENDCOMINTERFACE

PIDXGIOutput TYPEDEF PTR IDXGIOutput
COMINTERFACE IDXGIOutput
CVIRTUAL SetPrivateData, DWORD, :PTR, :PTR, :DWORD, :PTR
CVIRTUAL SetPrivateDataInterface, DWORD, :PTR, :PTR, :PTR
CVIRTUAL GetPrivateData, DWORD, :PTR, :PTR, :PTR, :PTR
CVIRTUAL GetParent, DWORD, :PTR, :PTR, :PTR

CVIRTUAL GetDesc, DWORD, :PTR
; .... Other methods
ENDCOMINTERFACE

DXGI_ADAPTER_DESC STRUCT
Description  dw 128 dup (?)
VendorId dd ?
DeviceId dd ?
SubSysId dd ?
Revision dd ?
DedicatedVideoMemory QWORD ?
DedicatedSystemMemory QWORD ?
SharedSystemMemory QWORD ?
AdapterLuid : QWORD
DXGI_ADAPTER_DESC ENDS

RECT STRUCT
left dd ?
top dd ?
right dd ?
bottom dd ?
RECT ENDS

DXGI_OUTPUT_DESC STRUCT
DeviceName dw 32 dup (?)
DesktopCoordinates RECT <>
AttachedToDesktop dd ?
Rotation dd ?
_Monitor qword ?
DXGI_OUTPUT_DESC ENDS

GUID    STRUCT
    Data1   dd ?
    Data2   dw ?
    Data3   dw ?
    Data4   db 8 dup(?)
GUID ENDS
   
.data
dxgidll db "dxgi.dll",0
tCreateDXGIFactory1 db "CreateDXGIFactory1",0
tCreateDXGIFactory db "CreateDXGIFactory",0
hDXGI dq ?
pCreateDXGIFactory dq ?
pDXGIFactor LPVOID ?
align 16
_IDXGIFactory TEXTEQU <{7b7166ech,21c7h,44aeh,{0b2h,1ah,0c9h,0aeh,32h,01ah,0e3h,069h}}>
IID_IDXGIFactory GUID _IDXGIFactory
_IDXGIFactory1 TEXTEQU <{770aae78h,0f26fh,4dbah,{0a8h,29h,025h,03ch,83h,0d1h,0b3h,087h}}>
IID_IDXGIFactory1 GUID _IDXGIFactory1

.code

EnumerateUsingDXGI PROC uses r12 r13 r14 r15 pDXGIFactory:PIDXGIFactory
LOCAL pAdapter : PIDXGIAdapter
LOCAL pOutput : PIDXGIOutput
LOCAL desc : DXGI_ADAPTER_DESC
LOCAL outputDesc : DXGI_OUTPUT_DESC

mov pDXGIFactory, rcx
mov r12,0

.WHILE 1
lea r13, pAdapter

pDXGIFactory->EnumAdapters(r12d, r13)
.IF rax<0
.break
.endif
INVOKE memset, addr desc, 0, SIZEOF DXGI_ADAPTER_DESC

pAdapter->GetDesc(ADDR desc)
.IF rax>=0
INVOKE wprintf, WSTR(10,"DXGI Adapter: %u",10,"Description: %s",10),r12d, \
addr [desc].Description

mov r14,0
.WHILE 1
mov pOutput,0
lea r13, pOutput
pAdapter->EnumOutputs(r14d, r13)
.IF rax<0
.break
.ENDIF
INVOKE memset, addr outputDesc, 0, SIZEOF DXGI_OUTPUT_DESC
pOutput->GetDesc(ADDR outputDesc)
.IF rax>=0
INVOKE wprintf, WSTR("hMonitor: 0x%0.8Ix",10), outputDesc._Monitor
INVOKE wprintf, WSTR("hMonitor Device Name: %s",10), addr [outputDesc].DeviceName
.ENDIF
;pOutput->Release() ;????
mov pOutput,0
inc r14
.ENDW

mov rax, desc.DedicatedVideoMemory
xor rdx, rdx
mov rcx, 1048576
div rcx
mov r10, rax

mov rax, desc.DedicatedSystemMemory
xor rdx, rdx
div rcx
mov r11, rax

mov rax, desc.SharedSystemMemory
xor rdx, rdx
div rcx
mov r13, rax

INVOKE wprintf, WSTR(9,"GetVideoMemoryViaDXGI",10,9,9,"DedicatedVideoMemory: %Iu MB (%Iu)",10,9,9,"DedicatedSystemMemory: %Iu MB (%Iu)",10,9,9,"SharedSystemMemory: %Iu MB (%Iu)",10),
r10, desc.DedicatedVideoMemory, r11, desc.DedicatedSystemMemory, r13, desc.SharedSystemMemory
.ELSE
;pAdapter->Release(); ???
;_VCOMINVOKE pAdapter,IDXGIAdapter,Release ;???
mov pAdapter,0
.ENDIF
inc r12
.ENDW

ret
EnumerateUsingDXGI ENDP

main PROC
INVOKE LoadLibraryA, offset dxgidll
.IF rax==0
ret
.ENDIF

mov hDXGI, rax
INVOKE GetProcAddress, hDXGI, offset tCreateDXGIFactory1
.IF rax==0
INVOKE GetProcAddress, hDXGI, offset tCreateDXGIFactory
.IF rax==0
INVOKE FreeLibrary, hDXGI
ret
.ENDIF
.ENDIF

mov pCreateDXGIFactory, rax
mov r10, rax
ASSUME r10 : ptr CreateDXGIFactory

INVOKE r10, addr IID_IDXGIFactory, addr pDXGIFactor
ASSUME r10: nothing
.IF rax<0
INVOKE FreeLibrary, hDXGI
ret
.ENDIF
mov rax, pDXGIFactor

INVOKE EnumerateUsingDXGI, rax
INVOKE ExitProcess,0

main ENDP

end
It should produce the following output but since I can't release the interfaces it does not work properly.

DXGI Adapter: 0
Description: NVIDIA GeForce GT 640
hMonitor: 0x00010001
hMonitor Device Name: \\.\DISPLAY2
hMonitor: 0x00010003
hMonitor Device Name: \\.\DISPLAY1
        GetVideoMemoryViaDXGI
                DedicatedVideoMemory: 1990 MB (2087387136)
                DedicatedSystemMemory: 0 MB (0)
                SharedSystemMemory: 2048 MB (2147807232)


Another thing, you mention that WSTR:
"Same as CSTR but for wide string data. Both of these are
provided for backwards compatibility with MASM as
UASM features direct support for string literal data in
invoke."

If it is only for backward compatibility how can I make INVOKE wprintf work without it? Like in the following:
INVOKE wprintf, WSTR(10,"DXGI Adapter: %u",10,"Description: %s",10),r12d, \
            addr [desc].Description

Another thing:
Your arrow operator uses the register r15 without preserving it. This will not be OK if you are working with ASM modules instead of standalone ASM applications.

Another thing:
Why can't I use HRESULT even if I typedef it in cases like this:
CVIRTUAL SetPrivateData, HRESULT, :PTR, :DWORD, :PTR
5
RadAsm IDE Support / Re: RadASM v2.2.2.3
« Last post by fearless on January 16, 2018, 11:39:49 PM »
Thanks HSE,

Yes I probably will change it to point to the repo in any future builds.
6
RadAsm IDE Support / Re: RadASM v2.2.2.3
« Last post by HSE on January 16, 2018, 11:20:41 PM »
Hi Fearless!

I think you must change the cherrytree location in the about dialog with present gitub location of your version (where there is references to original files)  :t
7
Examples / Re: Working prototype of a custom text button control
« Last post by LiaoMi on January 16, 2018, 07:24:13 PM »
Cool example! Thank you hutch  :icon_exclaim:
8
The Orphanage / Re: mysterious virus
« Last post by LiaoMi on January 16, 2018, 07:23:10 PM »
Hi shankle,

this is normal practice, when there is a detection of some modification of the Internet settings, this can be a potentially unsafe program, or a rare program to work with the Internet. Try to use RogueKiller free and then AdwCleaner. If you downloaded the program from the official page, then there is definitely no virus, if there is no identification, it does not mean that there is no virus or this program has disappeared. You need to find out where the virus was stored, what program it belongs to and then add it to Malwarebytes exceptions.
9
MASM32 / QE Run Program
« Last post by sinsi on January 16, 2018, 05:31:54 PM »
How does QE run the program? I see in menus.ini the command, but does it use CreateProcess or ShellExecute?
If I try to run an elevated program it just fails, no error or anything, which sounds like CreateProcess, whereas ShellExecute will show the elevation dialog.
10
Examples / Re: Working prototype of a custom text button control
« Last post by WillASM on January 16, 2018, 02:51:11 PM »
Looks great on Win7 Hutch..  :t
Pages: [1] 2 3 ... 10