You are not logged in.
Pages: 1
I have write 2 DLL to import/export data to/from my database.
When I call the DLL I export my database so the DLL can use it. The "import" library use only framework code, the "export" library use SELECT sql (ExecuteList) to select export field.
If my application is run as server or standalone application (use setUser as Admin), I can call the DLLs but I need use setUser as Admin inside DLL, in alternative the DLL is call but not work (I tested only "export" library that use SELECT sql).
If I try to call the DLL from my client application (use setUser as Supervisor) I have an exception when export the server to my DLL.
I have this problem after use the framework authentication system (without it all works)so:
1) Can only the administrator user export server to DLL?
2) Is there a way to allow my client to use my DLL?
3) Why inside my DLL I need set the user as Admin to call a simple SELECT sql Client.ExecuteList()? setUser as Supervisor DON'T PERMET USE sql to read the database?
Last edited by array81 (2012-02-24 14:45:56)
Offline
Ok, this is the code of my application used to call the DLL
var
fHND: THandle;
DLLExport: TDLLExport;
begin
if FileExists(AppPath + 'clexport.dll') then
begin
DatabaseServer.ExportServer;
fHND := LoadLibrary(pChar(AppPath + 'clexport.dll'));
try
if fHND <> 0 then
begin
@DLLExport := getProcAddress(fHND, 'DLLExport');
DLLExport(LanguageManager.Folder, LanguageManager.LanguageCode, URIRequest, '', '', '', '', '');
end
else
begin
MessageDlgLM('ContLab', MSG_DLLNOTLOAD + ' - clexport.dll', mtError, [mbOK]);
end;
finally
if fHND <> 0 then
FreeLibrary(fHND);
end;
end
else
begin
MessageDlgLM('ContLab', MSG_DLLNOTFOUND + ' - clexport.dll', mtError, [mbOK]);
end;
and this is the code of my DLL:
procedure DLLExport(LangPath, LangCode: string; MyURI: TURIMapRequest; SelectedProjects, SelectedContacts, SelectedAgenda, SelectedPasswords, SelectedNotes: string);
begin
Client := TSQLRestClientURIDll.Create(GetDatabaseModel(), MyURI);
//Client.SetUser('Supervisor', 'synopse');
Client.SetUser('Admin', 'synopse');
if client <> nil then
begin
ASelectedProjects := SelectedProjects;
ASelectedContacts := SelectedContacts;
ASelectedAgenda := SelectedAgenda;
ASelectedPasswords := SelectedPasswords;
ASelectedNotes := SelectedNotes;
ExportForm := TExportForm.Create(nil);
try
ExportForm.nbPages.ActivePageIndex := 0;
ExportForm.ShowModal;
finally
ExportForm.Free;
end;
client.Free;
end
else
begin
//MessageDlg('CLIENT NIL', mtConfirmation, [mbOK], 0);
end;
end;
As you see I use setUser() inside DLL. If I use Admin I can use ExecuteList in alternative (if I use Supervisor) ExecuteList return nil object:
sql := 'SELECT Agenda.RecordCreated AS Created, Agenda.RecordModified AS Modified, Agenda.Title AS Title, Agenda.Place AS Place, Agenda.Priority AS Priority, ' + 'Agenda.Kind AS Kind, Agenda.Color AS Color, Agenda.Note AS Note, Agenda.DateFrom AS Date_From, Agenda.DateTo AS Date_To, Agenda.AllDay AS All_Day, ' + 'Agenda.Allarm AS Allarm, Agenda.AllarmKind AS Allarm_Kind, Agenda.AllarmWhen AS Allarm_Where, Agenda.AllarmWhenKind AS Allarm_When_Kind FROM Agenda';
Tabella := Client.ExecuteList([], sql);
Besides I can call the DLL (with the first code of this post) only if I use my application as administrator, if I try to call as supervisor I get an exception...
Any ideas?
Last edited by array81 (2012-03-07 14:42:53)
Offline
Summarizing, I have 2 problem:
1) I need use administrator user to call the DLL. I cannot use it with other type of user (I have problem with supervisor user).
2) I need set administrator user inside the application to call a simple SELECT sql, the supervisor user infact return nil object.
so
1) Can I export the server to a DLL withy different user from Admin? (in my case with Supervisor )
2) I need setUser as Admin inside a DLL to call a SELECT sql?
Last edited by array81 (2012-03-07 14:44:55)
Offline
Pages: 1