Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // test.cxx
- #include <stdio.h>
- #include <windows.h>
- #include "test.h"
- int __cdecl main( int argc, char* argv[ ] )
- {
- unsigned long long* ptr = (unsigned long long*) new unsigned long long [ 16 ];
- unsigned long long refval = (unsigned long long) setval( ptr );
- unsigned long long val = (unsigned long long) getval( );
- printf( "refval: %I64u\n", refval );
- printf( "val: %I64u\n", val );
- printf( "*ptr: %I64u (before __stosq)\n", *ptr );
- __stosq( (unsigned __int64*) ptr, (unsigned __int64) 0ui64, 16 );
- printf( "*ptr: %I64u (after __stosq)\n", *ptr );
- delete [] ptr;
- return 0;
- }
- // test.h
- #ifdef __cplusplus
- extern "C" {
- #endif
- unsigned __int64 __fastcall getval( void );
- unsigned __int64 __fastcall setval( unsigned __int64* refval );
- #ifdef __cplusplus
- }
- #endif
- ;Assembler code for test.cxx program
- ;--------------------------------------------------------------------------
- ;unsigned __int64 __fastcall getval( void );
- ;unsigned __int64 __fastcall setval( unsigned __int64* refval );
- ;--------------------------------------------------------------------------
- .CODE
- ;--------------------------------------------------------------------------
- getval PROC
- MOV RAX,12345678ABCDEF00H
- RET
- getval ENDP
- ;--------------------------------------------------------------------------
- refval$ = 8 ; RCX
- setval PROC
- MOV RAX,0FEDCBA987654321H
- XCHG RAX,[RCX]
- RET
- setval ENDP
- ;--------------------------------------------------------------------------
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement