Arsip: Tolong dikoreksi...

 
user image
more 12 years ago

saladin

saya minta tolong koreksi source code di bawah, udah bener atau msh ada yg salah??. Sorce code aslinya c++, saya coba konversi ke delphi.. C++ : --------------------------------------------------------------------------------------------------------- static MSV1_0_INTERACTIVE_LOGON _allocLogonRequest( const wchar_t domain, const wchar_t user, const wchar_t pass, DWORD pcbRequest) { const DWORD cbHeader = sizeof(MSV1_0_INTERACTIVE_LOGON); const DWORD cbDom = _stringLenInBytes(domain); const DWORD cbUser = _stringLenInBytes(user); const DWORD cbPass = _stringLenInBytes(pass); // sanity check string lengths if (cbDom > USHRT_MAX || cbUser > USHRT_MAX || cbPass > USHRT_MAX) { LCF(L"Input string was too long"); return 0; } pcbRequest = cbHeader + cbDom + cbUser + cbPass; MSV1_0_INTERACTIVE_LOGON pRequest = (MSV1_0_INTERACTIVE_LOGON )new char[pcbRequest]; if (!pRequest) { LOOM; return 0; } pRequest->MessageType = MsV1_0InteractiveLogon; char p = (char)(pRequest + 1); // point past MSV1_0_INTERACTIVE_LOGON header wchar_t pDom = (wchar_t)(p); wchar_t pUser = (wchar_t)(p + cbDom); wchar_t pPass = (wchar_t)(p + cbDom + cbUser); CopyMemory(pDom, domain, cbDom); CopyMemory(pUser, user, cbUser); CopyMemory(pPass, pass, cbPass); _initUnicodeString(&pRequest->LogonDomainName, pDom, (USHORT)cbDom); _initUnicodeString(&pRequest->UserName, pUser, (USHORT)cbUser); _initUnicodeString(&pRequest->Password, pPass, (USHORT)cbPass); return pRequest; } --------------------------------------------------------------------- Delphi : ----------------------------------------------------------------------- function allocLogonRequest(const Domain : PWideChar; const User : PWideChar; const Password : PWideChar; pcbRequest : PDWORD): PMSV1_0_INTERACTIVE_LOGON; var cbHeader, cbDom, cbUser, cbPass : DWORD; pRequest : PMSV1_0_INTERACTIVE_LOGON; p : PWChar; pDom, pUser, pPass : PWideChar; begin cbHeader := SizeOf(MSV1_0_INTERACTIVE_LOGON); cbDom := stringLenInBytes(Domain); cbUser := stringLenInBytes(User); cbPass := stringLenInBytes(Password); if (cbDom > 65535) or (cbUser > 65535) or (cbPass > 65535) then begin Result := nil; Exit; end; pcbRequest^ := cbHeader + cbDom + cbUser + cbPass; { MSV1_0_INTERACTIVE_LOGON pRequest = (MSV1_0_INTERACTIVE_LOGON)new char[ pcbRequest]; } // -> kode delphi nya bagaiman ?? if pRequest = nil then begin Result := nil; Exit; end; pRequest.MessageType := MsV1_0InteractiveLogon; p := PWideChar(pRequest); Inc(Integer(p)); pDom := p; pUser := PWideChar(Integer(p) + cbDom); pPass := PWideChar(Integer(p) + cbDom + cbUser); CopyMemory(pDom, Domain, cbDom); CopyMemory(pUser, User, cbUser); CopyMemory(pPass, Password, cbPass); initUnicodeString(@pRequest.LogonDomainName, pDom, USHORT(cbDom)); initUnicodeString(@pRequest.UserName, pUser, USHORT(cbUser)); initUnicodeString(@pRequest.Password, pPass, USHORT(cbPass)); Result := pRequest; end; --------------------------------------------------------------------------- Kalo ad yg salah, tlg dijelasin slhnya di mana... dan bagaiman seharusnya.. Terima kasih sebelumnya.... O ya ada yg tau prog utk konversi c++ ke delphi, biar lbh gmpang gitu... :D
user image
user image
more 12 years ago

saladin

@madi: mungkin bisa dg spt ini...hehehe http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_23167162.html
thank's buat reply nya.. tapi kyknya blm ckup membantu ato mas madi mau nambahin jwban lgi... :) saya minta tlong translate MSV1_0_INTERACTIVE_LOGON pRequest = (MSV1_0_INTERACTIVE_LOGON )new char; klo bisa sih semuanya mas... :) directive new di c++ apakah sama dgn array di delphi? Temen2 yg lain yg mau ksih masukan silahkan...
user image
more 12 years ago

mas_kofa

directive new di c++ apakah sama dgn array di delphi?
di delphi New itu untuk pointer
user image
more 12 years ago

madi

wedew
thank's buat reply nya.. tapi kyknya blm ckup membantu ato mas madi mau nambahin jwban lgi... Smile saya minta tlong translate MSV1_0_INTERACTIVE_LOGON pRequest = (MSV1_0_INTERACTIVE_LOGON )new char; klo bisa sih semuanya mas...
itu aza ya cman kasih info, lha baca codingnya aja perutku dah muwal2 mas...apalagi mbantu sampean ntransletkan...xixixi...
user image
more 12 years ago

saladin

O gitu.. ya dh tak ushin goggling lgi lah. trm ksh banyak jwbannya.. tapi saya msih tunggu jwban dari temen2...
user image
more 12 years ago

saladin

piye iki... ada yg bisa bantu g...? Aq stress? ----> ya deadline kelewat? -----> ya bos ngamuk? -----> ngamuk sih enggak, cemberut ya... pc meledak? ----> hampir..
more ...
  • Pages:
  • 1
Share to

Random Topic

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com