800061 ランダム
 HOME | DIARY | PROFILE 【フォローする】 【ログイン】

さすらいのプログラマ

MSMQOpenQueue

int MSMQOpenQueue(LPSTR pszPathName, DWORD dwAccess, DWORD dwShareMode, QUEUEHANDLE *phQueue) {
  HRESULT hr;

  char szFullPathName[256];
  LPWSTR PathName;
#define BUFSIZE                    256
  DWORD dwFormatNameBufferLength = BUFSIZE;
  WCHAR wszFormatNameBuffer[BUFSIZE];

  wsprintf(szFullPathName, ".\\PRIVATE$\\%s", pszPathName);
  PathName = Ansi2Unicode(szFullPathName, NULL);
  hr = MQPathNameToFormatName(PathName,
                              wszFormatNameBuffer,
                              &dwFormatNameBufferLength);
  GlobalFree(PathName);
  if (FAILED(hr)) {
    return hr;
  }
  
  hr = MQOpenQueue(wszFormatNameBuffer,
                   dwAccess,
                   dwShareMode,
                   phQueue
                   );
  if (FAILED(hr)) {
    return hr;
  }

  return hr;
}


Copyright (c) 1997-2019 Rakuten, Inc. All Rights Reserved.