Author Topic: New "getvendor.asm" file.  (Read 2877 times)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10583
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
New "getvendor.asm" file.
« on: December 20, 2016, 10:48:58 AM »
This one jumped up and bit me once I started using large amounts of memory. As soon as the algo ran the app dropped dead. In its original form I had used EAX rather than RAX as the register to hold the address, changed it after tracking down where the crash occurred and its reliable with software using the /LARGEADDRESSAWARE linker option.

I have attached a single asm library module to replace it. Unzip the file, overwrite the one in the current library with the new one and run "makeit.bat" and all should be well.

This is the module.


; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    include \masm32\include64\masm64rt.inc

    .code

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

Get_Vendor proc pBuffer:QWORD

  ; -----------------------------------------------
  ; pBuffer needs to be at least 16 bytes in length
  ; -----------------------------------------------

    LOCAL .ebx :DWORD

    mov .ebx, ebx
   
    mov eax, 0                          ; set ID string for Intel
    cpuid

    mov rax, pBuffer                    ; (pBuffer) load buffer address into RAX

    mov [rax],    ebx                   ; write results to buffer
    mov [rax+4],  edx
    mov [rax+8],  ecx
    mov BYTE PTR [rax+12], 0

    mov ebx, .ebx
   
    ret

Get_Vendor endp

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    end
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy: