Reactos

[NETAPI32] Add RPC binding code to remaining functions that require explicit binding

+67 -27
+67 -27
dll/win32/netapi32/wksta_new.c
··· 211 211 _In_opt_ LPCWSTR DomainAccountPassword, 212 212 _In_ ULONG Reserved) 213 213 { 214 - PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword; 215 - handle_t BindingHandle; 214 + PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword = NULL; 215 + handle_t BindingHandle = NULL; 216 216 NET_API_STATUS status; 217 217 218 218 TRACE("NetAddAlternateComputerName(%s %s %s %s 0x%lx)\n", ··· 220 220 debugstr_w(DomainAccountPassword), Reserved); 221 221 222 222 /* FIXME */ 223 - BindingHandle = NULL; 224 - EncryptedPassword = NULL; 223 + 224 + status = NetpBind(Server, 225 + &BindingHandle); 226 + if (status != NERR_Success) 227 + { 228 + ERR("NetpBind() failed (status 0x%lx)\n", status); 229 + return status; 230 + } 225 231 226 232 RpcTryExcept 227 233 { ··· 237 243 status = I_RpcMapWin32Status(RpcExceptionCode()); 238 244 } 239 245 RpcEndExcept; 246 + 247 + NetpUnbind(BindingHandle); 240 248 241 249 return status; 242 250 } ··· 340 348 NET_API_STATUS 341 349 WINAPI 342 350 NetGetJoinableOUs( 343 - _In_ LPCWSTR lpServer, 351 + _In_opt_ LPCWSTR lpServer, 344 352 _In_ LPCWSTR lpDomain, 345 - _In_ LPCWSTR lpAccount, 346 - _In_ LPCWSTR lpPassword, 353 + _In_opt_ LPCWSTR lpAccount, 354 + _In_opt_ LPCWSTR lpPassword, 347 355 _Out_ DWORD *OUCount, 348 356 _Out_ LPWSTR **OUs) 349 357 { 350 - PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword; 351 - handle_t BindingHandle; 358 + PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword = NULL; 359 + handle_t BindingHandle = NULL; 352 360 NET_API_STATUS status; 353 361 354 362 TRACE("NetGetJoinableOUs(%s %s %s %s %p %p)\n", ··· 356 364 debugstr_w(lpPassword), OUCount, OUs); 357 365 358 366 /* FIXME */ 359 - BindingHandle = NULL; 360 - EncryptedPassword = NULL; 367 + 368 + status = NetpBind(lpServer, 369 + &BindingHandle); 370 + if (status != NERR_Success) 371 + { 372 + ERR("NetpBind() failed (status 0x%lx)\n", status); 373 + return status; 374 + } 361 375 362 376 RpcTryExcept 363 377 { ··· 374 388 status = I_RpcMapWin32Status(RpcExceptionCode()); 375 389 } 376 390 RpcEndExcept; 391 + 392 + NetpUnbind(BindingHandle); 377 393 378 394 return status; 379 395 } ··· 440 456 _In_opt_ LPCWSTR DomainAccountPassword, 441 457 _In_ ULONG Reserved) 442 458 { 443 - PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword; 444 - handle_t BindingHandle; 459 + PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword = NULL; 460 + handle_t BindingHandle = NULL; 445 461 NET_API_STATUS status; 446 462 447 463 TRACE("NetRemoveAlternateComputerName(%s %s %s %s 0x%lx)\n", ··· 449 465 debugstr_w(DomainAccountPassword), Reserved); 450 466 451 467 /* FIXME */ 452 - BindingHandle = NULL; 453 - EncryptedPassword = NULL; 468 + 469 + status = NetpBind(Server, 470 + &BindingHandle); 471 + if (status != NERR_Success) 472 + { 473 + ERR("NetpBind() failed (status 0x%lx)\n", status); 474 + return status; 475 + } 454 476 455 477 RpcTryExcept 456 478 { ··· 467 489 } 468 490 RpcEndExcept; 469 491 492 + NetpUnbind(BindingHandle); 493 + 470 494 return status; 471 495 } 472 496 ··· 474 498 NET_API_STATUS 475 499 WINAPI 476 500 NetRenameMachineInDomain( 477 - _In_ LPCWSTR lpServer, 478 - _In_ LPCWSTR lpNewMachineName, 479 - _In_ LPCWSTR lpAccount, 480 - _In_ LPCWSTR lpPassword, 501 + _In_opt_ LPCWSTR lpServer, 502 + _In_opt_ LPCWSTR lpNewMachineName, 503 + _In_opt_ LPCWSTR lpAccount, 504 + _In_opt_ LPCWSTR lpPassword, 481 505 _In_ DWORD fRenameOptions) 482 506 { 483 - PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword; 484 - handle_t BindingHandle; 507 + PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword = NULL; 508 + handle_t BindingHandle = NULL; 485 509 NET_API_STATUS status; 486 510 487 511 TRACE("NetRenameMachineInDomain(%s %s %s %s 0x%lx)\n", ··· 489 513 debugstr_w(lpPassword), fRenameOptions); 490 514 491 515 /* FIXME */ 492 - BindingHandle = NULL; 493 - EncryptedPassword = NULL; 516 + 517 + status = NetpBind(lpServer, 518 + &BindingHandle); 519 + if (status != NERR_Success) 520 + { 521 + ERR("NetpBind() failed (status 0x%lx)\n", status); 522 + return status; 523 + } 494 524 495 525 RpcTryExcept 496 526 { ··· 507 537 } 508 538 RpcEndExcept; 509 539 540 + NetpUnbind(BindingHandle); 541 + 510 542 return status; 511 543 } 512 544 ··· 520 552 _In_opt_ LPCWSTR DomainAccountPassword, 521 553 _In_ ULONG Reserved) 522 554 { 523 - PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword; 524 - handle_t BindingHandle; 555 + PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword = NULL; 556 + handle_t BindingHandle = NULL; 525 557 NET_API_STATUS status; 526 558 527 559 TRACE("NetSetPrimaryComputerName(%s %s %s %s %lu)\n", ··· 529 561 debugstr_w(DomainAccountPassword), Reserved); 530 562 531 563 /* FIXME */ 532 - BindingHandle = NULL; 533 - EncryptedPassword = NULL; 564 + 565 + status = NetpBind(Server, 566 + &BindingHandle); 567 + if (status != NERR_Success) 568 + { 569 + ERR("NetpBind() failed (status 0x%lx)\n", status); 570 + return status; 571 + } 534 572 535 573 RpcTryExcept 536 574 { ··· 546 584 status = I_RpcMapWin32Status(RpcExceptionCode()); 547 585 } 548 586 RpcEndExcept; 587 + 588 + NetpUnbind(BindingHandle); 549 589 550 590 return status; 551 591 }