Re: NullReferenceException after a Marshal.StructureToPtr
From: Seasanctuary (seasanctuary_at_yahoo.com)
Date: 05/18/04
- Next message: Phil Wilson: "Re: Windows Script Host Object Model in C#"
- Previous message: AlexS: "Re: EXE is both Windows and Console"
- In reply to: Seasanctuary: "Re: NullReferenceException after a Marshal.StructureToPtr"
- Next in thread: Mattias Sjögren: "Re: NullReferenceException after a Marshal.StructureToPtr"
- Messages sorted by: [ date ] [ thread ]
Date: 18 May 2004 10:38:58 -0700
I've noticed that if I set ecList.nUser = 0 instead of = 1 then
AddUsersToEncryptedFile completes without the NullReferenceException.
I'm inclined to think that I'm missing an array initialization.
pUsers is supposed to be a pointer to the first member of the array of
certificates. I'm just giving it a pointer to the one certificate
I've set up. Perhaps the marshaller needs to be told it's dealing
with an array so it remembers to initialize one, even if it will only
hold the one value and even if the number of array members is listed
in nUser.
Am I on the right track here?
Thanks,
Seasanctuary
////Excerpt from what I posted last time for quick reference...
//Put the one encryption certificate in a list (of one member).
Win32.ENCRYPTION_CERTIFICATE_LIST ecList;
ecList.nUser = 1;
ecList.pUsers = encryptionCertificatePointer;
//Finally, the encryption certificate list can be applied to a certain
file.
string targetFile = @"C:\test.txt";
Win32.AddUsersToEncryptedFile(targetFile, ref ecList);
- Next message: Phil Wilson: "Re: Windows Script Host Object Model in C#"
- Previous message: AlexS: "Re: EXE is both Windows and Console"
- In reply to: Seasanctuary: "Re: NullReferenceException after a Marshal.StructureToPtr"
- Next in thread: Mattias Sjögren: "Re: NullReferenceException after a Marshal.StructureToPtr"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|