Create Paradox的db檔,如何加密碼 |
尚未結案
|
vivi_11202001
一般會員 發表:1 回覆:1 積分:0 註冊:2003-09-26 發送簡訊給我 |
|
hagar
版主 發表:143 回覆:4056 積分:4445 註冊:2002-04-14 發送簡訊給我 |
http://groups.google.com.tw/groups?hl=zh-TW&lr=&ie=UTF-8&oe=UTF-8&th=db197bfe7c6ebf48&rnum=9
//----------------------------------------------------------------------// // This functions are copied from Borland Developer support www page // //----------------------------------------------------------------------// function GetSecNoFromName(hDb: hDBIDb; TblName, pswd: string): word; forward; procedure AddMasterPassword(Table: TTable; pswd: string); const RESTRUCTURE_TRUE = WordBool(1); var TblDesc: CRTblDesc; hDb: hDBIDb; begin { Make sure that the table is opened and is exclusive } if (Table.Active = False) or (Table.Exclusive = False) then raise EDatabaseError.Create('Table must be opened in exclusive mode to add passwords'); { Initialize the table descriptor } FillChar(TblDesc, SizeOf(CRTblDesc), 0); with TblDesc do begin { Place the table name in descriptor } StrPCopy(szTblName, Table.TableName); { Place the table type in descriptor } StrCopy(szTblType, szPARADOX); { Master Password, Password } StrPCopy(szPassword, pswd); { Set bProtected to True } bProtected := RESTRUCTURE_TRUE; end; { Get the database handle from the cursor handle } Check(DbiGetObjFromObj(hDBIObj(Table.Handle), objDATABASE, hDBIObj(hDb))); { Close the table } Table.Close; { Add the master password to the Paradox table } Check(DbiDoRestructure(hDb, 1, @TblDesc, nil, nil, nil, FALSE)); { Add the new password to the session } Session.AddPassword(pswd); { Re-Open the table } Table.Open; end; procedure RemoveMasterPassword(Table: TTable); const RESTRUCTURE_FALSE = WordBool(0); var TblDesc: CRTblDesc; hDb: hDBIDb; begin { Make sure that the table is opened and is exclusive } if (Table.Active = False) or (Table.Exclusive = False) then raise EDatabaseError.Create('Table must be opened in exclusive mode to remove passwords'); { Initialize the table descriptor } FillChar(TblDesc, SizeOf(CRTblDesc), 0); with TblDesc do begin { Place the table name in descriptor } StrPCopy(szTblName, Table.TableName); { Place the table type in descriptor } StrCopy(szTblType, szPARADOX); { Set bProtected to False } bProtected := RESTRUCTURE_FALSE; end; { Get the database handle from the cursor handle } Check(DbiGetObjFromObj(hDBIObj(Table.Handle), objDATABASE, hDBIObj(hDb))); { Close the table } Table.Close; { Add the master password to the Paradox table } Check(DbiDoRestructure(hDb, 1, @TblDesc, nil, nil, nil, FALSE)); { Re-Open the table } Table.Open; end;-- He just never quits. 發表人 - hagar 於 2004/04/02 17:37:56 |
vivi_11202001
一般會員 發表:1 回覆:1 積分:0 註冊:2003-09-26 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |