該程序模擬UNIX中save與resume函數,并介紹在VC中如何使用匯編進行機器級的操作. 主函數很簡單首先引入兩個外部函數,extern "C"表示按傳統C命名習慣.函數save將程序指針保存在(*s)中并返回0,為什么有 if(save(&sp)){...} if后的語句看起來永遠都不會被執行,但是運行結果表明它被執行了.這個問題同UNIX中處理機調度函數(switch)的那個if語句(第一句)一樣. 程序執行完save(&sp)后得到因為條件為假而執行else語句,卻在判斷之前將程序指針保存在sp中了. else語句中的resume(&sp),該函數很狡猾將堆棧中的返回地址改變了,改到了sp所指出,即將程序指針改到了執行條件判斷前.resume返回1,條件滿足,執行if語句. save函數堆棧: eip ebp+8 s ebp+4 ebp ebp+0 resume函數堆棧與save的相同. 新建一個win32的工程,將unixc.cpp和unix.obj加入過程即可. unix.obj是用masm6.11生成的:ml /c /coff unix.asm,生成coff格式的obj而不是omf格式.
上傳時間: 2015-09-10
上傳用戶:變形金剛
我在三做的課程,當時拿到了95分,包括完整的報告,有IF/else/read/for等語句的plo
標簽:
上傳時間: 2014-12-22
上傳用戶:123啊
Visual Basic 6.0可以通過調用API函數格式化一個磁盤,無論是軟盤還是硬盤。 打開一個新的項目(工程1) ,如果你沒有更改過缺省模式,那么Visual Basic 6.0會自動添加一個form1文件,在form1上添加一個命令控件,將下面的代碼拷入。 Option Explicit Private Declare Function SHFormatDrive Lib"shell32"( ByVal Hend AS Long,ByVal Drive AS Long,ByVal FormatID AS Long,ByVal Options AS Long) as Long Private Sub FormatDisk(intDrive as integer,blnQuickFormat as Boolean) dim lngReturn As Long if (blnQuickFormat) then lngReturn= SHFormatDrive(0,intDrive,0&,1&) else lngReturn= SHFormatDrive(0,intDrive,0&,0&) end if end Sub Private Sub Command1_Click() call FormatDisk(0,True) End Sub 運行此程序。 注意FormatDisk函數的第一個變量很重要,他的值是0,1,2時代表格式化的分別是:A、B、C盤。
上傳時間: 2015-10-05
上傳用戶:kytqcool
<%@ LANGUAGE="VBSCRIPT" %> <!--#include file="conn.asp" --> <% ProductClass_2=request("ProductClass_2") set rs=server.createobject("adodb.recordset") sqltext="select * from Product" if request("Product_Name")<>"" then sqltext=sqltext &" where Product_Name like %"& request("Product_Name") &"% " else sqltext=sqltext &" where Product_Name like %"& "" &"% " end if if request("Product_Class")<>"" then sqltext=sqltext &" and Class_1 like %"& request("Product_Class") &"% " end if
標簽: ProductClass lt LANGUAGE VBSCRIPT
上傳時間: 2013-11-25
上傳用戶:wl9454
% 文件名:randlsbget.m % 程序員:余波 % 編寫時間:2007.6.25 % 函數功能: 本函數將完成提取隱秘于上的秘密信息 % 輸入格式舉例:result=( scover.jpg ,56, secret.txt ,2001) % 參數說明: % output是信息隱藏后的圖象 % len_total是秘密信息的長度 % goalfile是提取出的秘密信息文件 % key是隨機間隔函數的密鑰 % result是提取的信息 function result=randlsbget(output,len_total,goalfile,key) ste_cover=imread(output) ste_cover=double(ste_cover) % 判斷嵌入信息量是否過大 [m,n]=size(ste_cover) frr=fopen(goalfile, a ) % p作為信息嵌入位計數器將信息序列寫回文本文件 p=1 % 調用隨機間隔函數選取像素點 [row,col]=randinterval(ste_cover,len_toal,key) for i=:len_toal if bitand(ste_cover(row(i),col(i)),1)==1 fwrite(frr,1, bit1 ) result(p,1) else fwrite(frr,0, bit1 ) result(p,1)=0 end if p==len_total break end p=p+1 end fclose(frr)
標簽: randlsbget result scover 2007
上傳時間: 2015-11-10
上傳用戶:yzhl1988
編譯原理的課程設計,if-else條件語句的翻譯,包括語法分析和詞法分析。
標簽: 編譯原理
上傳時間: 2015-11-13
上傳用戶:牧羊人8920
#include<iostream> using namespace std int main() { unsigned long x,warcraft,war,l cin> x while(x) { unsigned long *p=new unsigned long[x+1] if(p==NULL) { cerr<<"error!"<<endl abort() } for(warcraft=0 warcraft<=x warcraft++) *(p+warcraft)=0 *p=1 for(warcraft=0 warcraft<x warcraft++) { cout<<*p<<" " war=*p for(l=1 x>1 l++) { if(*(p+l)==0) { cout<<endl *(p+l)=1 break } else { cout<<*(p+l)<<" " *(p+l)=war+*(p+l) war=*(p+l)-war } } } cout<<endl delete [] p cin>>x } return 0 }
標簽: namespace iostream unsigned warcraft
上傳時間: 2015-12-12
上傳用戶:manlian
procedureTForm1.Button1Click(Sender:TObject) var S:String begin S:=idhttp1.Get(PostURL.text+ ?username= +EdUserName.Text+ &password= +EdPassWord.Text+ &password2= +EdPassWord.Text+ &email= + EdEMail.Text+ &gendernew=1&year=&month=&day=&locationnew =&site=&oicq=&icq=&yahoo=&msn=&bio=&styleidnew =&tppnew=0&pppnew=0&timeformatnew=12&cstatus=&dateformatnew =yyyy-mm-dd&showemail=1&newsletter=1&timeoffsetnew=8&avatar =&sig=®submit=注冊 ) //一句代碼 ifPos( 非常感謝您的注冊 ,s)>1then //判斷部分 ShowMessage( 注冊成功! ) else ifPos( 已經被注冊了 ,S)>1then ShowMessage( 該用戶名或E-Mail已被注冊! ) else ShowMessage( 已關閉注冊,注冊失敗! ) end
標簽: procedureTForm PostURL TObject Button
上傳時間: 2014-08-24
上傳用戶:努力努力再努力
一個表達式計算庫,支持算術,邏輯運算,位運算,支持多層級的if/then/else,功能強大。
上傳時間: 2013-12-27
上傳用戶:teddysha
Floyd-Warshall算法描述 1)適用范圍: a)APSP(All Pairs Shortest Paths) b)稠密圖效果最佳 c)邊權可正可負 2)算法描述: a)初始化:dis[u,v]=w[u,v] b)For k:=1 to n For i:=1 to n For j:=1 to n If dis[i,j]>dis[i,k]+dis[k,j] Then Dis[I,j]:=dis[I,k]+dis[k,j] c)算法結束:dis即為所有點對的最短路徑矩陣 3)算法小結:此算法簡單有效,由于三重循環結構緊湊,對于稠密圖,效率要高于執行|V|次Dijkstra算法。時間復雜度O(n^3)。 考慮下列變形:如(I,j)∈E則dis[I,j]初始為1,else初始為0,這樣的Floyd算法最后的最短路徑矩陣即成為一個判斷I,j是否有通路的矩陣。更簡單的,我們可以把dis設成boolean類型,則每次可以用“dis[I,j]:=dis[I,j]or(dis[I,k]and dis[k,j])”來代替算法描述中的藍色部分,可以更直觀地得到I,j的連通情況。
標簽: Floyd-Warshall Shortest Pairs Paths
上傳時間: 2013-12-01
上傳用戶:dyctj