本文整理汇总了C++中RpcExceptionCode函数的典型用法代码示例。如果您正苦于以下问题:C++ RpcExceptionCode函数的具体用法?C++ RpcExceptionCode怎么用?C++ RpcExceptionCode使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RpcExceptionCode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: kull_m_rpc_bkrp_generic
BOOL kull_m_rpc_bkrp_generic(LPCWSTR NetworkAddr, const GUID * pGuid, PVOID DataIn, DWORD dwDataIn, PVOID *pDataOut, DWORD *pdwDataOut)
{
BOOL status = FALSE;
RPC_BINDING_HANDLE hBinding;
NET_API_STATUS netStatus;
PBYTE out = NULL;
*pDataOut = NULL;
*pdwDataOut = 0;
if(kull_m_rpc_bkrp_createBinding(NetworkAddr, &hBinding))
{
RpcTryExcept
{
netStatus = BackuprKey(hBinding, (GUID *) pGuid, (PBYTE) DataIn, dwDataIn, &out, pdwDataOut, 0);
if(status = (netStatus == 0))
{
if(*pDataOut = LocalAlloc(LPTR, *pdwDataOut))
RtlCopyMemory(*pDataOut, out, *pdwDataOut);
MIDL_user_free(out);
}
else PRINT_ERROR(L"BackuprKey: 0x%08x (%u)\n", netStatus, netStatus);
}
RpcExcept(RPC_EXCEPTION)
PRINT_ERROR(L"RPC Exception: 0x%08x (%u)\n", RpcExceptionCode(), RpcExceptionCode());
RpcEndExcept
kull_m_rpc_deleteBinding(&hBinding);
}
示例2: kull_m_rpc_drsr_getDCBind
BOOL kull_m_rpc_drsr_getDCBind(RPC_BINDING_HANDLE *hBinding, GUID *NtdsDsaObjectGuid, DRS_HANDLE *hDrs)
{
BOOL status = FALSE;
ULONG drsStatus;
DRS_EXTENSIONS_INT DrsExtensionsInt;// = {0};
DRS_EXTENSIONS *pDrsExtensionsOutput = NULL;
DrsExtensionsInt.cb = sizeof(DRS_EXTENSIONS_INT) - sizeof(DWORD);
DrsExtensionsInt.dwFlags = DRS_EXT_GETCHGREPLY_V6 | DRS_EXT_STRONG_ENCRYPTION;
RpcTryExcept
{
drsStatus = IDL_DRSBind(*hBinding, NtdsDsaObjectGuid, (DRS_EXTENSIONS *) &DrsExtensionsInt, &pDrsExtensionsOutput, hDrs); // to free ?
if(drsStatus == 0)
{
if(pDrsExtensionsOutput)
{
if(((DRS_EXTENSIONS_INT *) pDrsExtensionsOutput)->dwFlags & (DRS_EXT_GETCHGREQ_V8 | DRS_EXT_STRONG_ENCRYPTION))
status = TRUE;
else PRINT_ERROR(L"Incorrect DRS Extensions Output (%08x)\n", ((DRS_EXTENSIONS_INT *) pDrsExtensionsOutput)->dwFlags);
MIDL_user_free(pDrsExtensionsOutput);
}
else PRINT_ERROR(L"No DRS Extensions Output\n");
if(!status)
IDL_DRSUnbind(hDrs);
}
else PRINT_ERROR(L"IDL_DRSBind: %u\n", drsStatus);
}
RpcExcept(DRS_EXCEPTION)
PRINT_ERROR(L"RPC Exception 0x%08x (%u)\n", RpcExceptionCode(), RpcExceptionCode());
RpcEndExcept
return status;
}
示例3: kull_m_rpc_Generic_Decode
BOOL kull_m_rpc_Generic_Decode(PVOID data, DWORD size, PVOID pObject, PGENERIC_RPC_DECODE fDecode)
{
BOOL status = FALSE;
RPC_STATUS rpcStatus;
PVOID buffer;
KULL_M_RPC_FCNSTRUCT UserState ;
handle_t pHandle;
if(buffer = UserState.addr = LocalAlloc(LPTR, size))
{
UserState.size = size;
RtlCopyMemory(UserState.addr, data, size); // avoid data alteration
rpcStatus = MesDecodeIncrementalHandleCreate(&UserState, ReadFcn, &pHandle);
if(NT_SUCCESS(rpcStatus))
{
rpcStatus = MesIncrementalHandleReset(pHandle, NULL, NULL, NULL, NULL, MES_DECODE);
if(NT_SUCCESS(rpcStatus))
{
RpcTryExcept
{
fDecode(pHandle, pObject);
status = TRUE;
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
PRINT_ERROR(L"RPC Exception: 0x%08x (%u)\n", RpcExceptionCode(), RpcExceptionCode());
RpcEndExcept
}
else PRINT_ERROR(L"MesIncrementalHandleReset: %08x\n", rpcStatus);
MesHandleFree(pHandle);
}
示例4: NetGetJoinInformation
NET_API_STATUS
NET_API_FUNCTION
NetGetJoinInformation(
LPCWSTR Server,
LPWSTR *Name,
PNETSETUP_JOIN_STATUS type)
{
NET_API_STATUS status;
TRACE("NetGetJoinInformation(%s %p %p)\n", debugstr_w(Server),
Name, type);
if (Name == NULL || type == NULL)
return ERROR_INVALID_PARAMETER;
RpcTryExcept
{
status = NetrGetJoinInformation((LPWSTR)Server,
Name,
type);
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
status = I_RpcMapWin32Status(RpcExceptionCode());
}
RpcEndExcept;
return status;
}
示例5: EnumPortsW
BOOL WINAPI
EnumPortsW(PWSTR pName, DWORD Level, PBYTE pPorts, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
{
DWORD dwErrorCode;
TRACE("EnumPortsW(%S, %lu, %p, %lu, %p, %p)\n", pName, Level, pPorts, cbBuf, pcbNeeded, pcReturned);
// Do the RPC call
RpcTryExcept
{
dwErrorCode = _RpcEnumPorts(pName, Level, pPorts, cbBuf, pcbNeeded, pcReturned);
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
dwErrorCode = RpcExceptionCode();
ERR("_RpcEnumPorts failed with exception code %lu!\n", dwErrorCode);
}
RpcEndExcept;
if (dwErrorCode == ERROR_SUCCESS)
{
// Replace relative offset addresses in the output by absolute pointers.
ASSERT(Level >= 1 && Level <= 2);
MarshallUpStructuresArray(cbBuf, pPorts, *pcReturned, pPortInfoMarshalling[Level]->pInfo, pPortInfoMarshalling[Level]->cbStructureSize, TRUE);
}
SetLastError(dwErrorCode);
return (dwErrorCode == ERROR_SUCCESS);
}
示例6: GetJobW
BOOL WINAPI
GetJobW(HANDLE hPrinter, DWORD JobId, DWORD Level, PBYTE pJob, DWORD cbBuf, PDWORD pcbNeeded)
{
DWORD dwErrorCode;
PSPOOLER_HANDLE pHandle = (PSPOOLER_HANDLE)hPrinter;
if (!pHandle)
{
dwErrorCode = ERROR_INVALID_HANDLE;
goto Cleanup;
}
// Do the RPC call
RpcTryExcept
{
dwErrorCode = _RpcGetJob(pHandle->hPrinter, JobId, Level, pJob, cbBuf, pcbNeeded);
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
dwErrorCode = RpcExceptionCode();
ERR("_RpcGetJob failed with exception code %lu!\n", dwErrorCode);
}
RpcEndExcept;
if (dwErrorCode == ERROR_SUCCESS)
{
// Replace relative offset addresses in the output by absolute pointers.
_MarshallUpJobInfo(pJob, Level);
}
Cleanup:
SetLastError(dwErrorCode);
return (dwErrorCode == ERROR_SUCCESS);
}
示例7: SetJobW
BOOL WINAPI
SetJobW(HANDLE hPrinter, DWORD JobId, DWORD Level, PBYTE pJobInfo, DWORD Command)
{
DWORD dwErrorCode;
PSPOOLER_HANDLE pHandle = (PSPOOLER_HANDLE)hPrinter;
WINSPOOL_JOB_CONTAINER JobContainer;
if (!pHandle)
{
dwErrorCode = ERROR_INVALID_HANDLE;
goto Cleanup;
}
// pJobContainer->JobInfo is a union of pointers, so we can just set any element to our BYTE pointer.
JobContainer.Level = Level;
JobContainer.JobInfo.Level1 = (WINSPOOL_JOB_INFO_1*)pJobInfo;
// Do the RPC call
RpcTryExcept
{
dwErrorCode = _RpcSetJob(pHandle->hPrinter, JobId, &JobContainer, Command);
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
dwErrorCode = RpcExceptionCode();
ERR("_RpcSetJob failed with exception code %lu!\n", dwErrorCode);
}
RpcEndExcept;
Cleanup:
SetLastError(dwErrorCode);
return (dwErrorCode == ERROR_SUCCESS);
}
示例8: NetWkstaUserSetInfo
NET_API_STATUS
WINAPI
NetWkstaUserSetInfo(
LPWSTR reserved,
DWORD level,
LPBYTE buf,
LPDWORD parm_err)
{
NET_API_STATUS status;
TRACE("NetWkstaSetInfo(%s, %d, %p, %p)\n", debugstr_w(reserved),
level, buf, parm_err);
if (reserved != NULL)
return ERROR_INVALID_PARAMETER;
RpcTryExcept
{
status = NetrWkstaUserSetInfo(NULL,
level,
(LPWKSTA_USER_INFO)&buf,
parm_err);
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
status = I_RpcMapWin32Status(RpcExceptionCode());
}
RpcEndExcept;
return status;
}
示例9: NetWkstaTransportAdd
NET_API_STATUS
WINAPI
NetWkstaTransportAdd(
LPWSTR servername,
DWORD level,
LPBYTE buf,
LPDWORD parm_err)
{
NET_API_STATUS status;
TRACE("NetWkstaTransportAdd(%s, %d, %p, %p)\n", debugstr_w(servername),
level, buf, parm_err);
RpcTryExcept
{
status = NetrWkstaTransportAdd(servername,
level,
(LPWKSTA_TRANSPORT_INFO_0)buf,
parm_err);
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
status = I_RpcMapWin32Status(RpcExceptionCode());
}
RpcEndExcept;
return status;
}
示例10: NetUseGetInfo
NET_API_STATUS
WINAPI
NetUseGetInfo(
LMSTR UncServerName,
LMSTR UseName,
DWORD Level,
LPBYTE *BufPtr)
{
NET_API_STATUS status;
TRACE("NetUseGetInfo(%s, %s, %d, %p)\n", debugstr_w(UncServerName),
debugstr_w(UseName), Level, BufPtr);
*BufPtr = NULL;
RpcTryExcept
{
status = NetrUseGetInfo(UncServerName,
UseName,
Level,
(LPUSE_INFO)BufPtr);
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
status = I_RpcMapWin32Status(RpcExceptionCode());
}
RpcEndExcept;
return status;
}
示例11: NetScheduleJobDel
NET_API_STATUS
WINAPI
NetScheduleJobDel(
LPCWSTR ServerName,
DWORD MinJobId,
DWORD MaxJobId)
{
NET_API_STATUS status;
TRACE("NetScheduleJobDel(%s, %d, %d)\n", debugstr_w(ServerName),
MinJobId, MaxJobId);
RpcTryExcept
{
status = NetrJobDel(ServerName,
MinJobId,
MaxJobId);
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
status = I_RpcMapWin32Status(RpcExceptionCode());
}
RpcEndExcept;
return status;
}
示例12: SetServiceStatus
/**********************************************************************
* SetServiceStatus
*
* @implemented
*/
BOOL WINAPI
SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus,
LPSERVICE_STATUS lpServiceStatus)
{
DWORD dwError;
TRACE("SetServiceStatus() called\n");
TRACE("hServiceStatus %lu\n", hServiceStatus);
RpcTryExcept
{
/* Call to services.exe using RPC */
dwError = RSetServiceStatus((RPC_SERVICE_STATUS_HANDLE)hServiceStatus,
lpServiceStatus);
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
dwError = ScmRpcStatusToWinError(RpcExceptionCode());
}
RpcEndExcept;
if (dwError != ERROR_SUCCESS)
{
ERR("ScmrSetServiceStatus() failed (Error %lu)\n", dwError);
SetLastError(dwError);
return FALSE;
}
TRACE("SetServiceStatus() done (ret %lu)\n", dwError);
return TRUE;
}
示例13: I_ScSetServiceBitsW
/**********************************************************************
* I_ScSetServiceBitsW
*
* Undocumented
*
* @implemented
*/
BOOL WINAPI
I_ScSetServiceBitsW(SERVICE_STATUS_HANDLE hServiceStatus,
DWORD dwServiceBits,
BOOL bSetBitsOn,
BOOL bUpdateImmediately,
LPWSTR lpString)
{
BOOL bResult;
RpcTryExcept
{
/* Call to services.exe using RPC */
bResult = RI_ScSetServiceBitsW((RPC_SERVICE_STATUS_HANDLE)hServiceStatus,
dwServiceBits,
bSetBitsOn,
bUpdateImmediately,
lpString);
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
SetLastError(ScmRpcStatusToWinError(RpcExceptionCode()));
bResult = FALSE;
}
RpcEndExcept;
return bResult;
}
示例14: RegisterEventSourceW
/******************************************************************************
* RegisterEventSourceW [[email protected]]
* Returns a registered handle to an event log
*
* PARAMS
* lpUNCServerName [I] Server name for source
* lpSourceName [I] Source name for registered handle
*
* RETURNS
* Success: Handle
* Failure: NULL
*/
HANDLE WINAPI
RegisterEventSourceW(IN LPCWSTR lpUNCServerName,
IN LPCWSTR lpSourceName)
{
UNICODE_STRING SourceName;
IELF_HANDLE LogHandle;
NTSTATUS Status;
TRACE("%s, %s\n", debugstr_w(lpUNCServerName), debugstr_w(lpSourceName));
RtlInitUnicodeString(&SourceName, lpSourceName);
RpcTryExcept
{
Status = ElfrRegisterEventSourceW((LPWSTR)lpUNCServerName,
(PRPC_UNICODE_STRING)&SourceName,
&EmptyStringU,
1,
1,
&LogHandle);
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
Status = I_RpcMapWin32Status(RpcExceptionCode());
}
RpcEndExcept;
if (!NT_SUCCESS(Status))
{
SetLastError(RtlNtStatusToDosError(Status));
return NULL;
}
return (HANDLE)LogHandle;
}
示例15: DeregisterEventSource
/******************************************************************************
* DeregisterEventSource [[email protected]]
* Closes a handle to the specified event log
*
* PARAMS
* hEventLog [I] Handle to event log
*
* RETURNS STD
*/
BOOL WINAPI
DeregisterEventSource(IN HANDLE hEventLog)
{
NTSTATUS Status;
TRACE("%p\n", hEventLog);
RpcTryExcept
{
Status = ElfrDeregisterEventSource(&hEventLog);
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
Status = I_RpcMapWin32Status(RpcExceptionCode());
}
RpcEndExcept;
if (!NT_SUCCESS(Status))
{
SetLastError(RtlNtStatusToDosError(Status));
return FALSE;
}
return TRUE;
}