⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 comqiptrassign.asm

📁 这是一个数字图像处理的matlab仿真程序
💻 ASM
字号:
;-------------------------------------------------------------------------------
;  colibrary procedure ComQIPtrAssign 
;
; -------------------------------------------------------
; This procedure was written by Ernest Murphy    9/27/00
;
;  revised 1/10/01 to add S_OK retval
;
; Copyright (c) 9/28/00  Ernest Murphy
; For educational use only. Any commercial re-use only by written license
;
; -------------------------------------------------------
.NOLIST
.386
.model flat, stdcall  ; 32 bit memory model
option casemap :none  ; case sensitive

include     mini_win.inc	; 'just enough' of windows.inc (speeds build)
include     \masm32\include\oleaut32.inc
include     \masm32\COM\include\oaidl.inc

include     colib.inc

.code
;-------------------------------------------------------------------------------

ComQIPtrAssign PROC PUBLIC pp:DWORD, lp:DWORD, riid:DWORD

;-------------------------------------------------------------------------------
; COM 'smart' pointer assignment
; (we can't do smart pointers, but this routine is handy none the less)
;
; performes pp <== QueryInterface lp, riid
;
;  first releases any existing pointer in pp
;
; EXAMPLE:
; invoke ComQIPtrAssign, ADDR pointerB, ADDR pointerA
;
; Uses: eax, ecx, edx
;
;
;  NOTE: this is completely untested
;
;-------------------------------------------------------------------------------
LOCAL pTemp:DWORD
    mov ecx, pp
    mov eax, [ecx]
    mov pTemp, eax  ; pTemp = *pp
    mov eax, NULL
    mov [ecx], eax  ; *pp = NULL
    .IF lp
        coinvoke lp, IUnknown, QueryInterface, riid, pp
    .ENDIF
    .IF pTemp
        coinvoke pTemp, IUnknown, Release
    .ENDIF
    mov ecx, pp     ; pp
    mov eax, [ecx]  ; *pp
    xor eax, eax    ; return S_OK    
    ret
ComQIPtrAssign ENDP
;-------------------------------------------------------------------------------

end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -