Jump to content

KarlEm

Members
  • Posts

    1
  • Joined

  • Last visited

KarlEm's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Too sad, that not the final code was posted. Here is my code. For Domain Credentials: DllStructSetData($NewCred,"Type",2) For Generic change: DllStructSetData($NewCred,"Type",1) Global $Target = "MeinServer" Global $User = "MeineDomainMeinUser" Global $Password = "MeinPWD" Global $Comm = "mein Kommentar" Global $Comment = DllStructCreate("wchar[100]") DllStructSetData($Comment,1,$Comm) Global $targetName = DllStructCreate("wchar[100]") DllStructSetData($targetName,1,$Target) Global $userName = DllStructCreate("wchar[100]") DllStructSetData($userName,1,$User) Global $credentialBlob = DllStructCreate("wchar[100]") DllStructSetData($credentialBlob,1,$Password) Global $structCREDENTIAL= "" & _ "DWORD Flags;" & _ "DWORD Type;" & _ "Ptr TargetName;" & _ "Ptr Comment;" & _ "UINT64 LastWritten;" & _ "DWORD CredintialBlobSize;" & _ "Ptr CredentialBlob;" & _ "DWORD Persist;" & _ "DWORD AttributeCount;" & _ "ptr Attributes;" & _ "Ptr TargetAlias;" & _ "Ptr Username" Global $NewCred = DllStructCreate($structCREDENTIAL) If @error Then MsgBox(0, "NewCred", "Error in DllStructCreate " & @error); Exit EndIf DllStructSetData($NewCred,"Flags",0) DllStructSetData($NewCred,"Type",2) DllStructSetData($NewCred,"TargetName",DllStructGetPtr($targetName)) DllStructSetData($NewCred,"Persist",3) DllStructSetData($NewCred,"AttributeCount",0) DllStructSetData($NewCred,"UserName",DllStructGetPtr($userName)) DllStructSetData($NewCred,"CredentialBlob",DllStructGetPtr($credentialBlob)) DllStructSetData($NewCred,"CredintialBlobSize",StringLen($Password)*2) DllStructSetData($NewCred,"Comment",DllStructGetPtr($Comment)) #comments-start MsgBox(0, "DllStruct", "Data:" & @CRLF & _ "Flags: " & DllStructGetData($NewCred, "Flags") & @CRLF & _ "Type: " & DllStructGetData($NewCred,"Type") & @CRLF & _ "TargetName: " & DllStructGetData($NewCred,"TargetName") & @CRLF & _ "Persist: " & DllStructGetData($NewCred,"Persist") & @CRLF & _ "AttributeCount: " & DllStructGetData($NewCred,"AttributeCount") & @CRLF & _ "UserName: " & DllStructGetData($NewCred,"UserName") & @CRLF & _ "CredentialBlob: " & DllStructGetData($NewCred,"CredentialBlob") & @CRLF & _ "CredintialBlobSize: " & DllStructGetData($NewCred,"CredintialBlobSize") & @CRLF & _ "Comment: " & DllStructGetData($NewCred,"Comment")) #comments-end Local $hAdvapi32 = DllOpen("Advapi32.dll") If @error Then Msgbox (0,"Error","Cannot open Advapi32.dll") Exit Endif $Ret = DllCall($hAdvapi32, 'bool', 'CredWriteW', 'ptr', DllStructGetPtr($NewCred), 'dword', 0) $NewCred = 0
×
×
  • Create New...