omg plzzzz help impossible conversion vb--->vb.net

  • Thread starter Thread starter isaac rainsford (MCSE)
  • Start date Start date
I

isaac rainsford (MCSE)

can anyone lend some assistance on how to convert some code to vb.net
from vb5?

in VB5 the code succeeds and the IF statement is processed, in Vb.NET
the code returns error and the msgbox returns an 18 digit error code!

thanks in advance

the code is:

Private Const SE_FILE_OBJECT = 1&
Private Const DACL_SECURITY_INFORMATION = 4&

Private Declare Function GetNamedSecurityInfo Lib "Advapi32.dll" Alias _
"GetNamedSecurityInfoA" _
(ByVal ObjName As String, _
ByVal SE_OBJECT_TYPE As Long, _
ByVal SecInfo As Long, _
ByVal pSid As Long, _
ByVal pSidGroup As Long, _
ByVal pDacl As Long, _
ByVal pSacl As Long, _
ByVal pSecurityDescriptor As Long) As Long

Dim result As Long
Dim pSecDesc As Long
Dim ea As Any
Dim pNewDACL As Long
Dim pOldDACL As Long

result = GetNamedSecurityInfo("c:\test1", SE_FILE_OBJECT, _
DACL_SECURITY_INFORMATION, 0&, 0&, pOldDACL, 0&, pSecDesc)

If result = ERROR_SUCCESS Then
... snip snip snip ...

Else
MsgBox("GetNamedSecurityInfo failed with error code : " & result)
End If
 
Hi Isaac,

There are newsgroups

microsoft.public.dotnet.languages.vb (one of the three most active dotnet
newsgroups), there is also a newsgroup
microsoft.public.dotnet.languages.vb.upgrading (however very inactive)

I would ask this question if mine does not solve your problem there.

My answer is in this always the same, have first a look in this page

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/win32map.asp

Finding an equivalent dotnet method will save you from problems in future,
(Think also on 64bit systems).

(The quicker answer is that a long in VB is an integer in VB.net)

I hope this helps?

Cor
 
chrz for the reply

hmmmm i did try using Integers instead of Longs, but i got overflows all
over the place at build time...

also, the reason i am keen to use GetNamedSecurity and
SetNamedSecurityInfo calls is that they can set permissions on AD
Objects (my example is OU's and Exchange Address Lists) as well as
Files, and even shares.

thanks for the www link i'll check it out, and ill make my umpteenth
shift to another newsgroup!!!
 
Back
Top