AD Octet string is really a structure composed of two members: a pointer to
a byte (LPBYTE), and a dword. The idea is that you have a binary string
but you can't tell how long it is, because unlike character strings, you
can't assume a terminating '\0' exists. that's whythe DWORd is there- it
tells you how Octet string length in bytes.
In VC, you would get the LPBYTE member into a byte array, and chop it off
using the dword.
then if you want to copy it you (usually using memcpy()), you know how many
bytes to copy, or write to a file.
I would assume that your file class has no idea how long the string is, and
so any results you get are completely random, sometimes it crashes (have you
looked at your logs for "access violation" messages?), sometimes not.
try and see if you can get the dword member of the octet string and use it
to write safely to the file. Since I don't have a clue about VB, I can't
help you more, sorry!
> Im trying to query AD and SAM via LDAP resp. WinNT for the
> AccountExpirationDate - value on a couple of user objects.
> The query seems to work fine but when I try to write the value to a
> text-file I get an error. Ive found out that the value is an "octet
> by viewing it from ADSI-Edit. The value is set for a few users and not set
> for a few others of them. Im confused if the problem occurs only when the
> value isnt set or if there is a general problem to write an "octet
> string"-value to a file and that I have to convert it first? I tried that
> well without any luck. Can anyone help me out?
> (Im able to write other account properties to the file including
> user.fullName, user.IsAccountDisabled, user.IsAccountLocked and more...)
> The crucial part of the script look something like this....
> Set user = GetObject("WinNT://domain/username",user)
> f.Write user.AccountExpirationDate