Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
1.8 KiB

  1. #include <pch.cxx>
  2. #pragma hdrstop
  3. #include <ole2.h>
  4. #include "trkwks.hxx"
  5. #include "dltadmin.hxx"
  6. BOOL
  7. DltAdminRefresh( ULONG cArgs, TCHAR * const rgptszArgs[], ULONG *pcEaten )
  8. {
  9. HRESULT hr = E_FAIL;
  10. RPC_STATUS rpcstatus;
  11. RPC_TCHAR * ptszStringBinding;
  12. RPC_BINDING_HANDLE hBinding = NULL;
  13. BOOL fBound = FALSE;
  14. TRKSVR_MESSAGE_UNION Msg;
  15. if( 1 <= cArgs && IsHelpArgument( rgptszArgs[0] ))
  16. {
  17. printf("\nOption Refresh\n"
  18. " Purpose: Tell the tracking service to update volume list\n"
  19. " Usage: -refresh\n" );
  20. return( TRUE );
  21. }
  22. rpcstatus = RpcStringBindingCompose( NULL, TEXT("ncalrpc"), NULL, TEXT("trkwks"),
  23. NULL, &ptszStringBinding);
  24. if( rpcstatus )
  25. {
  26. TrkLog(( TRKDBG_ERROR, TEXT("Failed RpcStringBindingCompose %lu"), rpcstatus ));
  27. hr = HRESULT_FROM_WIN32(rpcstatus);
  28. goto Exit;
  29. }
  30. rpcstatus = RpcBindingFromStringBinding( ptszStringBinding, &hBinding );
  31. RpcStringFree( &ptszStringBinding );
  32. if( rpcstatus )
  33. {
  34. TrkLog(( TRKDBG_ERROR, TEXT("Failed RpcBindingFromStringBinding") ));
  35. hr = HRESULT_FROM_WIN32(rpcstatus);
  36. goto Exit;
  37. }
  38. fBound = TRUE;
  39. memset( &Msg, 0, sizeof(Msg) );
  40. Msg.MessageType = WKS_VOLUME_REFRESH;
  41. Msg.Priority = PRI_0;
  42. __try
  43. {
  44. hr = LnkCallSvrMessage( hBinding, &Msg);
  45. }
  46. __except( EXCEPTION_EXECUTE_HANDLER )
  47. {
  48. hr = HRESULT_FROM_WIN32( GetExceptionCode() );
  49. }
  50. if( FAILED(hr) )
  51. {
  52. _tprintf( TEXT("Failed call to service (%08x)\n"), hr );
  53. goto Exit;
  54. }
  55. Exit:
  56. if( fBound )
  57. RpcBindingFree( &hBinding );
  58. return( TRUE );
  59. } // main()