WMI, Delphi 6 und Vista



hi,

ich hab ein kleines problem: ich schreibe für gamers.irc eine DLL, die es ermöglicht systeminfos abzufragen. ich habe das meiste über WMI realisiert, da ich damit am meisten infos bekomme. nur das problem ist, sobald diese funktion aufgerufen wird, stürzt mIRC unter windows vista ab.

hier der verwendete code:

function GetWMIstring (wmiHost, wmiClass, wmiProperty : string; wminum: integer):string;
var
Locator: ISWbemLocator;
Services: ISWbemServices;
SObject: ISWbemObject;
ObjSet: ISWbemObjectSet;
SProp: ISWbemProperty;
Enum: IEnumVariant;
Value: Cardinal;
TempObj: OleVariant;
SN: string;
begin
try
Locator := CoSWbemLocator.Create;
Services := Locator.ConnectServer(wmiHost, 'root\cimv2', '', '', '','', 0, nil);
ObjSet := Services.ExecQuery('SELECT * FROM '+wmiClass, 'WQL',
wbemFlagReturnImmediately and wbemFlagForwardOnly , nil);
Enum := (ObjSet._NewEnum) as IEnumVariant;
while (Enum.Next(wminum, TempObj, Value) = S_OK) do
begin
SObject := IUnknown(tempObj) as ISWBemObject;
SProp := SObject.Properties_.Item(wmiProperty, 0);
begin
SN := SProp.Get_Value;
result := SN;
end;
end;
except
on exception do
result := '';
end;
end;

unter windows xp funzt alles wunderbar, nur unter vista kommt es dann zum absturz. wäre nett wenn mir einer helfen kann.

MfG Hybrid666
.



Relevant Pages

  • Re: WMI, Delphi 6 und Vista
    ... ich schreibe für gamers.irc eine DLL, ... ich habe das meiste über WMI realisiert, da ich damit am meisten infos bekomme. ... nur das problem ist, sobald diese funktion aufgerufen wird, stürzt mIRC unter windows vista ab. ... function GetWMIstring:string; ...
    (de.comp.lang.delphi.misc)
  • [NT] mIRC $asctime Buffer Overflow
    ... through calling $asctime with a carefully constructed string. ... The default script included with mIRC does not call $asctime at any point. ... However the majority of major scripts available for download call $asctime ... formats the current time using the format specified. ...
    (Securiteam)
  • Re: how do i get string into.........
    ... how do i get string into combobox? ... mirc. ... i put in declaration section: ... and in sub new ...
    (microsoft.public.dotnet.languages.vb)