Einzelnen Beitrag anzeigen

Benutzerbild von cherry
cherry

Registriert seit: 14. Nov 2005
561 Beiträge
 
RAD-Studio 2009 Ent
 
#53

Re: Zugriffsverletzung ADSI, so was komisches hab ich noch n

  Alt 24. Feb 2010, 10:09
Zitat von Dezipaitor:
Hast du geschrieben, dass du die Übersetzung selbst gemacht oder irgendwoher kopiert hast?
Ich habe den Wrapper von Agnisoft, da ich mir Anfangs nicht bewusst war, dass eine JEDI version existierte.

Ok. Ich verwende jetzt die jedi Units und es funktioniert soweit super. Nur habe ich immer noch das Problem, dass ich mit den HRESULT nicht klar komme...

Ich nehme nochmals das Besipiel (AdsGetObject)

Mit untenstehendem Code ergibt sich folgendes:
#1: Ich verwende einen Falschen Benutzername und Passwort -> result = 16 >> S_ADS_ERRORSOCCURRED
#2: Ich will auf ein Objekt zugreiffen das nicht existiert -> result = 0 >> Keine Übereinstimmung

Delphi-Quellcode:
 
    result := '0';
    if (hr and E_ADS_BAD_PATHNAME) = 0 then
      result := '1'
    else if (hr and E_ADS_INVALID_DOMAIN_OBJECT) = 0 then
      result := '2'
    else if (hr and E_ADS_INVALID_USER_OBJECT) = 0 then
      result := '3'
    else if (hr and E_ADS_UNKNOWN_OBJECT) = 0 then
      result := '4'
    else if (hr and E_ADS_PROPERTY_NOT_SET) = 0 then
      result := '5'
    else if (hr and E_ADS_PROPERTY_NOT_SUPPORTED) = 0 then
      result := '6'
    else if (hr and E_ADS_PROPERTY_INVALID) = 0 then
      result := '7'
    else if (hr and E_ADS_OBJECT_UNBOUND) = 0 then
      result := '8'
    else if (hr and E_ADS_PROPERTY_NOT_MODIFIED) = 0 then
      result := '9'
    else if (hr and E_ADS_PROPERTY_MODIFIED) = 0 then
      result := '10'
    else if (hr and E_ADS_CANT_CONVERT_DATATYPE) = 0 then
      result := '11'
    else if (hr and E_ADS_PROPERTY_NOT_FOUND) = 0 then
      result := '12'
    else if (hr and E_ADS_OBJECT_EXISTS) = 0 then
      result := '13'
    else if (hr and E_ADS_SCHEMA_VIOLATION) = 0 then
      result := '14'
    else if (hr and E_ADS_COLUMN_NOT_SET) = 0 then
      result := '15'
    else if (hr and S_ADS_ERRORSOCCURRED) = 0 then
      result := '16'
    else if (hr and S_ADS_NOMORE_ROWS) = 0 then
      result := '17'
    else if (hr and S_ADS_NOMORE_COLUMNS) = 0 then
      result := '18'
    else if (hr and E_ADS_INVALID_FILTER) = 0 then
      result := '19';
Nun mache ich das Selbe, verwende aber die Vergleichsweise die mir Corpsman unterbreitet hat:
#1: Ich verwende einen Falschen Benutzername und Passwort -> result = 0 >> Keine Übereinstimmung
#2: Ich will auf ein Objekt zugreiffen das nicht existiert -> result = 0 >> Keine Übereinstimmung

Delphi-Quellcode:
 
    result := '0';
    if ((hr and E_ADS_BAD_PATHNAME) = E_ADS_BAD_PATHNAME) then
      result := '1'
    else if ((hr and E_ADS_INVALID_DOMAIN_OBJECT) = E_ADS_INVALID_DOMAIN_OBJECT) then
      result := '2'
    else if ((hr and E_ADS_INVALID_USER_OBJECT) = E_ADS_INVALID_USER_OBJECT) then
      result := '3'
    else if ((hr and E_ADS_UNKNOWN_OBJECT) = E_ADS_UNKNOWN_OBJECT) then
      result := '4'
    else if ((hr and E_ADS_PROPERTY_NOT_SET) = E_ADS_PROPERTY_NOT_SET) then
      result := '5'
    else if ((hr and E_ADS_PROPERTY_NOT_SUPPORTED) = E_ADS_PROPERTY_NOT_SUPPORTED) then
      result := '6'
    else if ((hr and E_ADS_PROPERTY_INVALID) = E_ADS_PROPERTY_INVALID) then
      result := '7'
    else if ((hr and E_ADS_OBJECT_UNBOUND) = E_ADS_OBJECT_UNBOUND) then
      result := '8'
    else if ((hr and E_ADS_PROPERTY_NOT_MODIFIED) = E_ADS_PROPERTY_NOT_MODIFIED) then
      result := '9'
    else if ((hr and E_ADS_PROPERTY_MODIFIED) = E_ADS_PROPERTY_MODIFIED) then
      result := '10'
    else if ((hr and E_ADS_CANT_CONVERT_DATATYPE) = E_ADS_CANT_CONVERT_DATATYPE) then
      result := '11'
    else if ((hr and E_ADS_PROPERTY_NOT_FOUND) = E_ADS_PROPERTY_NOT_FOUND) then
      result := '12'
    else if ((hr and E_ADS_OBJECT_EXISTS) = E_ADS_OBJECT_EXISTS) then
      result := '13'
    else if ((hr and E_ADS_SCHEMA_VIOLATION) = E_ADS_SCHEMA_VIOLATION) then
      result := '14'
    else if ((hr and E_ADS_COLUMN_NOT_SET) = E_ADS_COLUMN_NOT_SET) then
      result := '15'
    else if ((hr and S_ADS_ERRORSOCCURRED) = S_ADS_ERRORSOCCURRED) then
      result := '16'
    else if ((hr and S_ADS_NOMORE_ROWS) = S_ADS_NOMORE_ROWS) then
      result := '17'
    else if ((hr and S_ADS_NOMORE_COLUMNS) = S_ADS_NOMORE_COLUMNS) then
      result := '18'
    else if ((hr and E_ADS_INVALID_FILTER) = E_ADS_INVALID_FILTER) then
      result := '19';
Ich habe das Ganze Spielchen auch noch mit Case hr of E_ADS_BAD_PATHNAME: usw ... gemacht,
auch hier ergab sich:

#1: Ich verwende einen Falschen Benutzername und Passwort -> result = 0 >> Keine Übereinstimmung
#2: Ich will auf ein Objekt zugreiffen das nicht existiert -> result = 0 >> Keine Übereinstimmung

Ich scheine ja wohl grundsätzlich was falsch zu machen, aber was?
Ist das nur mein Gefühl, oder ist die ganze Welt verrückt geworden!?
  Mit Zitat antworten Zitat