Win32 彙編,如何向指定檔案寫入內容

2025-01-27 22:40:18 字數 3834 閱讀 7166

1樓:楊_劉

要寫入的檔案內容放到中,向中寫入的內容,**:

data segment

file1 db '',0

file2 db '',0

inbuf db 256 dup(?)

handle1 dw ?

handle2 dw ?

data ends

code segment

assume cs:code,ds:datastart: mov ax,data

mov ds,ax

mov ah,3dh

mov al,0

lea dx,file1

int 21h

mov handle1,ax

mov ah,3ch

mov cx,00

lea dx,file2

int 21h

mov handle2,ax

black: mov ah,3fh

mov bx,handle1

mov cx,1

lea dx,inbuf

int 21h

cmp ax,0

je out1

mov ah,40h

mov bx,handle2

mov cx,1

lea dx,inbuf

int 21h

jmp black

out1: mov ah,4ch

int 21h

code ends

end start

2樓:胡楊胖子

file db 'c:\',0

sztext db 'xyz',0

字串後面要加0,你沒加所以file就變成了'c:\',0(可能剛好numberwrite這有0)

win32彙編,如何將exe寫入資原始檔,並在主程式exe呼叫?

3樓:網友

一般會被大多數防毒軟體報毒的吧。簡單的方法是用winrar或者其它軟體打包。

組合語言寫入txt檔案

4樓:網友

.com是什麼指令?昨天剛剛看了點bat的內容,執行com**不知道怎麼弄。

不過前面一條可以是。

shundown -s >>

歡迎來到幽靈**論壇win32彙編板塊。

c++編寫的win32程式如何實現對文件中儲存資料的輸入和輸出?

5樓:緣明思

3全部視窗嗎?放在load()裡吧。載入視窗時就進行讀取和顯示。如果你沒有類似查詢最高分的按鈕的話。如果有,那就按的時候載入到乙個記憶體變數裡,然後顯示時就能用了。

問題二,lpstr這個我還真不熟。而且好像textout也不是用的lpstr,用的是lpctstr。希望能對你有所幫助。

virtual bool textout(int x,int y,lpctstr lpszstring,int ncount

bool textout(

int x,int y,const cstring& str);

6樓:質疑的左手

只寫過win32彙編和c++,按個人理解說幾句。

首先inhighestscore肯定是在視窗初始化之後,才能執行的。

接著是textout(),執行這個函式,有沒有調函式重繪視窗。

最後,記錄歷史最高分這種功能,最好是用登錄檔實現,要麼用inf檔案,自己建立檔案的話,不太好。

求乙個win32彙編寫的程式,實現根據輸入的路徑名查詢檔案的功能

7樓:手機使用者

findfile proc _lpszpath

local @stfindfile:win32_find_data

local @hfindfile

local @szpath[max_path]:byte ;用來存放「路徑\」

local @szsearch[max_path]:byte ;用來存放「路徑\*.

local @szfindfile[max_path]:byte ;用來存放「路徑\找到的檔案」

pushad

invoke lstrcpy,addr @szpath,_lpszpath

在路徑後面加上\*.

invoke lstrlen,addr @szpath

lea esi,@szpath

add esi,eax

xor eax,eax

mov al,'\'

if byte ptr [esi-1] != al

mov word ptr [esi],ax

endifinvoke lstrcpy,addr @szsearch,addr @szpath

invoke lstrcat,addr @szsearch,addr szfilter

尋找檔案。invoke findfirstfile,addr @szsearch,addr @stfindfile

if eax != invalid_handle_value

mov @hfindfile,eax

repeat

invoke lstrcpy,addr @szfindfile,addr @szpath

invoke lstrcat,addr @szfindfile,addr

if & file_attribute_directory

if != '.'

inc dwfoldercount

invoke _findfile,addr @szfindfile

endifelse

invoke _processfile,addr @szfindfile

endifinvoke findnextfile,@hfindfile,addr @stfindfile

until (eax == false) |dwoption & f_stop)

invoke findclose,@hfindfile

endifpopad

retfindfile endp

求設定檔案為唯讀或可寫屬性的win32組合語言函式

8樓:網友

檔案沒有隻寫這個屬性。要寫檔案必然是要讀的。所有你的要求是不可能的。

windows也沒有提供這樣一種屬性,你自己右鍵看看有沒有隻寫屬性 。是沒有的。在msdn也找不到。

所以,你的想法是實現不了的。下面我假如windows提供了乙個只寫屬性 file_attribute_writeonly(注意是假如,實際上並沒有)。所以下面的**只是乙個參考,實際上並不能編譯的。

setattribute proc lpfilename:dword

invoke getfileattributes,addr lpfilename

mov ebx,eax

and ebx,file_attribute_readonly

or ebx,ebx

je setwriteonly

or eax,file_attribute_writeonly

jne setreadonly

retsetwriteonly:

invoke setfileattributes,lpfilename,file_attribute_writeonly

retsetreadonly:

invoke setfileattributes,lpfilename,file_attribute_readonly

setattribute endp

CMD不是有效的win32應用程式

方法一 可能是你的環境變境改變了,把環境變數改回來即可右鍵 我的電腦 屬性 高階 環境變數 再找到並雙擊開啟 系統環境變數 下的path變數,如果沒有則手動新建一個。看他的變數值裡有沒有包含c windows system32 假定你係統裝c盤 或 systemroot system32等等 按你所...

不是有效的win32應用程式怎麼解決

如果是在雙擊執行任意一個exe格式的可執行檔案都會出現這樣的錯誤資訊時,這可能由於系統感染了病毒所造成的,此時可通過以下措施來解決問題。查殺病毒並刪除登錄檔資訊。windows registry editor version hkey classes hkey classes rootexe aut...

不是有效的win32應用程式怎麼解決

方法 步驟。如果是在雙擊執行任意一個exe格式的可執行檔案都會出現這樣的錯誤資訊時,這可能由於系統感染了病毒所造成的,此時可通過以下措施來解決問題。查殺病毒並刪除登錄檔資訊。windows registry editor version hkey classes hkey classes roote...