Paradox Security - Adding Passwords 
Author Message
 Paradox Security - Adding Passwords

Looks like a ton of work.  Why not just restructure the table in the
Database Desktop?  Over at the drop down that normally starts with Validity
Checks, there's an entry for Password Security where you can specify the
main password and auxiliary passwords for a table.

Tons easier, would take lots less time.
/js


Quote:


>> My problem is that I want my application to create a password that
>> will unlock
>>  my database.  The way that I want to do this is to encrypt it by
>> adding a
>>  password.  I know how to add a password to the session but how would
>> I add a
>>  password to the database table directly.

>> Thanks
>> Tim Harmon

>Tim,
>I just did this exact thing yesterday.  I took me 9 hours to figure it
>out! You have to use the BDE API calls.
>Here is a sample of the code you need.
>I got the examples from 'Delphi Databse Development', by Blue,Kaster,
>Lief, and Scott (ISBN 1-55851-469-4)
>And this book, 'KickAss Delphi', by Taylor, Mischel, Penman, and Goggin
>(ISBN 1-57610-044-8).

>Here is the code, and don't forget to add BDE to your uses list.

>procedure PackPassword(oTable: TTable);
>var
>  iResult: DBIResult;
>  szErrMsg: DBIMSG;
>  pTblDesc: pCRTblDesc;
>  AHandle: hDBiDB;
>begin
>  //start the restructuring...
>  with oTable do
>  begin
>    DisableControls;
>    Close;
>    Exclusive := True;
>  end;

>  //for ttParadox tabletype only!!!
>  GetMem(pTblDesc, SizeOf(CRTblDesc)); //get the memory for the
>struct...
>  FillChar(pTblDesc^, SizeOf(CRTblDesc) ,0); //fill the
>struct(record)w/0!
>  with pTblDesc^ do
>  begin
>    StrPCopy(szTblName, oTable.TableName);
>    StrPCopy(szTblType, szParadox);
>    StrPCopy(szPassword, 'SuCcEsS');
>    bProtected := True;
>    bPack := True;
>  end;
>  //from kickass book! this problem to get the table handle took me over

>  //10 hours of programming!! only to find out that the table has to be
>  //active in order to grab the freaking handle!  Millions of thanks
>goes to
>  //the book: 'Kickass Delphi', by Taylor, Mischel, Penman, & Goggin.
>  with oTable do
>  begin
>    Active := True;
>    AHandle := oTable.DBHandle;
>    Active := False;
>  end;//end of with...
>  //end of the needed code from kickass delphi book...

>  iResult := DbiDoRestructure(AHandle, 1, pTblDesc, nil, nil, nil,
>False);
>  if iResult <> DBIERR_NONE then
>  begin
>    DbiGetErrorString(iResult, szErrMsg);
>    MessageDlg('RESTRUCT ERR: '+szErrMsg, mtError, [mbOk],0);
>  end;
>  //Close table
>  with oTable do
>  begin
>    Close;
>    EnableControls;
>    Exclusive := False;
>  end;

>  //free the memory...
>  FreeMem(pTblDesc, SizeOf(CRTblDesc));
>end;//end of PackPassword procedure.

>GOOD LUCK!
>--
>John M. Romero
>-



Mon, 10 Apr 2000 03:00:00 GMT  
 Paradox Security - Adding Passwords

Quote:

> My problem is that I want my application to create a password that
> will unlock
>  my database.  The way that I want to do this is to encrypt it by
> adding a
>  password.  I know how to add a password to the session but how would
> I add a
>  password to the database table directly.

> Thanks
> Tim Harmon

Tim,
I just did this exact thing yesterday.  I took me 9 hours to figure it
out! You have to use the BDE API calls.
Here is a sample of the code you need.
I got the examples from 'Delphi Databse Development', by Blue,Kaster,
Lief, and Scott (ISBN 1-55851-469-4)
And this book, 'KickAss Delphi', by Taylor, Mischel, Penman, and Goggin
(ISBN 1-57610-044-8).

Here is the code, and don't forget to add BDE to your uses list.

procedure PackPassword(oTable: TTable);
var
  iResult: DBIResult;
  szErrMsg: DBIMSG;
  pTblDesc: pCRTblDesc;
  AHandle: hDBiDB;
begin
  //start the restructuring...
  with oTable do
  begin
    DisableControls;
    Close;
    Exclusive := True;
  end;

  //for ttParadox tabletype only!!!
  GetMem(pTblDesc, SizeOf(CRTblDesc)); //get the memory for the
struct...
  FillChar(pTblDesc^, SizeOf(CRTblDesc) ,0); //fill the
struct(record)w/0!
  with pTblDesc^ do
  begin
    StrPCopy(szTblName, oTable.TableName);
    StrPCopy(szTblType, szParadox);
    StrPCopy(szPassword, 'SuCcEsS');
    bProtected := True;
    bPack := True;
  end;
  //from kickass book! this problem to get the table handle took me over

  //10 hours of programming!! only to find out that the table has to be
  //active in order to grab the freaking handle!  Millions of thanks
goes to
  //the book: 'Kickass Delphi', by Taylor, Mischel, Penman, & Goggin.
  with oTable do
  begin
    Active := True;
    AHandle := oTable.DBHandle;
    Active := False;
  end;//end of with...
  //end of the needed code from kickass delphi book...

  iResult := DbiDoRestructure(AHandle, 1, pTblDesc, nil, nil, nil,
False);
  if iResult <> DBIERR_NONE then
  begin
    DbiGetErrorString(iResult, szErrMsg);
    MessageDlg('RESTRUCT ERR: '+szErrMsg, mtError, [mbOk],0);
  end;
  //Close table
  with oTable do
  begin
    Close;
    EnableControls;
    Exclusive := False;
  end;

  //free the memory...
  FreeMem(pTblDesc, SizeOf(CRTblDesc));
end;//end of PackPassword procedure.

GOOD LUCK!
--
John M. Romero
---------------------------------
Join The Coalition Against
Unsolicited Commercial Email at
http://www.cauce.org/index.html
---------------------------------
John M. Romero's Homepage
http://www.alpha1.net/~romero



Mon, 10 Apr 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. HELP -- How to add password security to PDox tables at runtime

2. Paradox Password Security

3. Password Security On Paradox Win5.x Table

4. Adding Paradox table passwords - Delphi 1.0

5. DbiDoRestructure- Adding passwords to paradox tables

6. D4: adding multiple Paradox passwords

7. Adding password to paradox table created by program

8. Adding password to new Paradox table???

9. adding passwords to paradox tables

10. Implementing minimal password security

11. Program access to password security?

12. Disturb Password Security in Local Interbase

 

 
Powered by phpBB® Forum Software