本文整理汇总了C++中ULONG函数的典型用法代码示例。如果您正苦于以下问题:C++ ULONG函数的具体用法?C++ ULONG怎么用?C++ ULONG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ULONG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeRegisterNoFence
template < typename _T_REG_UNION > __forceinline void writeRegisterNoFence (
_T_REG_UNION RegUnion
) const throw ()
{
C_ASSERT(sizeof(UINT32) == sizeof(ULONG));
ULONG* const regPtr = reinterpret_cast<ULONG*>(
ULONG_PTR(this->basePtr) + ULONG(RegUnion.OFFSET));
::WRITE_REGISTER_NOFENCE_ULONG(regPtr, RegUnion.AsUint32);
} // writeRegisterNoFence<...> ( _T_REG_UNION )
示例2: switch
/// SimpleDPX::ReadData
// Read a single pixel from the specified file.
UQUAD SimpleDPX::ReadData(FILE *in,const struct ImageElement *el,bool issigned)
{
// The specs seem to indicate that data is always packed into 32-bit LONGs,
// no matter what. Interestingly, not all software seems to follow this,
// but for this time, accept only correctly formulated data.
switch(el->m_ucBitDepth) {
case 32:
return GetLong(in);
case 64:
{
UQUAD q1,q2;
q1 = GetLong(in);
q2 = GetLong(in);
if (m_bLittleEndian) {
return q1 | (q1 << 32);
} else {
return q2 | (q1 << 32);
}
}
default:
if (el->m_ucBitDepth < 32) {
ULONG res = 0;
UBYTE sign = el->m_ucBitDepth;
UBYTE bits = el->m_ucBitDepth;
UBYTE shift = 0;
do {
// Refill the buffer if only the padding bits are left, or no bits are left.
if (m_cBit <= el->m_ucMSBPaddingBits) {
// Fill up the bit-buffer.
m_ulBitBuffer = GetLong(in);
m_cBit = 32;
//
// If LSB padding is on, remove now the LSB bits.
m_cBit -= el->m_ucLSBPaddingBits;
}
UBYTE avail = m_cBit;
if (avail > bits)
avail = bits; // do not remove more bits than requested.
// remove avail bits from the byte
res |= ((m_ulBitBuffer >> (32 - m_cBit)) & ((1UL << avail) - 1)) << shift;
bits -= avail;
shift += avail;
m_cBit -= avail;
} while(bits);
if (el->m_ucPackElements == 1)
m_cBit -= el->m_ucLSBPaddingBits + el->m_ucMSBPaddingBits;
if (issigned) {
if (res & (1 << (sign - 1))) { // result is negative
res |= ULONG(-1) << sign;
}
}
return res;
} else {
示例3: readRegisterNoFence
template < typename _T_REG_UNION > __forceinline void readRegisterNoFence (
_Out_ _T_REG_UNION* RegUnionPtr
) const throw ()
{
C_ASSERT(sizeof(UINT32) == sizeof(ULONG));
ULONG* const regPtr = reinterpret_cast<ULONG*>(
ULONG_PTR(this->basePtr) + ULONG(RegUnionPtr->OFFSET));
RegUnionPtr->AsUint32 = ::READ_REGISTER_NOFENCE_ULONG(regPtr);
} // readRegisterNoFence<...> ( _T_REG_UNION* )
示例4: Convert_Character_String_to_BSTR
void CISO::PostToWatch(char *pMessage)
{
if ((NULL != pMessage) && (NULL != m_pComm))
{
BSTR bstr_out;
Convert_Character_String_to_BSTR(pMessage, bstr_out);
m_pComm->SendToWatch(bstr_out, ULONG(m_iNode));
}
}
示例5: DoMAPISendDocuments
void
DoMAPISendDocuments(HWND hWnd)
{
ULONG (FAR PASCAL *lpfnMAPISendDocuments) (ULONG ulUIParam,
LPTSTR lpszDelimChar, LPTSTR lpszFullPaths,
LPTSTR lpszFileNames, ULONG ulReserved);
#ifdef WIN16
(FARPROC&) lpfnMAPISendDocuments = GetProcAddress(m_hInstMapi, "MAPISENDDOCUMENTS");
#else
(FARPROC&) lpfnMAPISendDocuments = GetProcAddress(m_hInstMapi, "MAPISendDocuments");
#endif
if (!lpfnMAPISendDocuments)
{
ShowMessage(hWnd, "Unable to locate MAPI function.");
return;
}
char msg[1024];
char tempFileName[_MAX_PATH] = "";
char lpszFullPaths[(_MAX_PATH + 1) * 4] = "";
char lpszFileNames[(_MAX_PATH + 1) * 4] = "";
// Now get the names of the files to attach...
GetDlgItemText(hWnd, ID_EDIT_ATTACH1, tempFileName, sizeof(tempFileName));
TackItOn(lpszFullPaths, lpszFileNames, tempFileName);
GetDlgItemText(hWnd, ID_EDIT_ATTACH2, tempFileName, sizeof(tempFileName));
TackItOn(lpszFullPaths, lpszFileNames, tempFileName);
GetDlgItemText(hWnd, ID_EDIT_ATTACH3, tempFileName, sizeof(tempFileName));
TackItOn(lpszFullPaths, lpszFileNames, tempFileName);
GetDlgItemText(hWnd, ID_EDIT_ATTACH4, tempFileName, sizeof(tempFileName));
TackItOn(lpszFullPaths, lpszFileNames, tempFileName);
LONG rc = (*lpfnMAPISendDocuments)
( (ULONG) hWnd,
lpszDelimChar,
lpszFullPaths,
lpszFileNames,
0);
if (rc == SUCCESS_SUCCESS)
{
ShowMessage(hWnd, "Success with MAPISendDocuments");
SetFooter("MAPISendDocuments success");
}
else
{
wsprintf(msg, "FAILURE: Return code %d from MAPISendDocuments\nError=[%s]",
rc, GetMAPIError(rc));
ShowMessage(hWnd, msg);
SetFooter("MAPISendDocuments failed");
}
}
示例6: print_alloc_info
void print_alloc_info(char *addr, int size){
if(addr){
fprintf(stderr, "ALLOC at : %lu (%d byte(s))\n",
ULONG(addr - memory), size);
}
else{
fprintf(stderr, "Warning, system is out of memory\n");
}
}
示例7: sizeof
/// Environ::AllocVec without reqments
void *Environ::AllocVec(size_t bytesize)
{
size_t *mem;
// This is build directly on AllocMem
bytesize += sizeof(union Align);
mem = (size_t *)CoreAllocMem(ULONG(bytesize),0);
*mem = bytesize; // enter the bytesize
return (void *)(ptrdiff_t(mem) + sizeof(union Align));
}
示例8: update_windows_counters
// Update the data to be exposed as the windows performance counter values.
void update_windows_counters(boost::uint64_t value)
{
// Set raw counter data for queue length.
ULONG status = PerfSetULongCounterValue
(HPXHeartBeat, queue_counter, 1, ULONG(value));
if (status != ERROR_SUCCESS) {
std::cerr << "PerfSetCounterRefValue for 'sum_queue_counter' failed "
"with error code: "
<< std::to_string(GetLastError());
return;
}
// Set raw counter data for average queue length.
status = PerfSetULongCounterValue(HPXHeartBeat, avg_queue_counter, 2, ULONG(value));
if (status != ERROR_SUCCESS) {
std::cerr << "PerfSetCounterRefValue for 'avg_queue_counter' failed "
"with error code: "
<< std::to_string(GetLastError());
return;
}
}
示例9: SetAvermediaEncoderConfig
bool SetAvermediaEncoderConfig(IBaseFilter *encoder, VideoEncoderConfig &config)
{
HRESULT hr;
ComQIPtr<IKsPropertySet> propertySet(encoder);
if (!propertySet) {
Warning(L"Could not get IKsPropertySet for encoder");
return false;
}
double fps = double(config.fpsNumerator) /
double(config.fpsDenominator);
hr = SetAVMEncoderSetting(propertySet,
AVER_PARAMETER_ENCODE_FRAME_RATE,
ULONG(fps), 0);
if (FAILED(hr)) {
WarningHR(L"Failed to set Avermedia encoder FPS", hr);
return false;
}
hr = SetAVMEncoderSetting(propertySet,
AVER_PARAMETER_ENCODE_BIT_RATE,
ULONG(config.bitrate), 0);
if (FAILED(hr)) {
WarningHR(L"Failed to set Avermedia encoder bitrate", hr);
return false;
}
hr = SetAVMEncoderSetting(propertySet,
AVER_PARAMETER_CURRENT_RESOLUTION,
ULONG(config.cx), ULONG(config.cy));
if (FAILED(hr)) {
WarningHR(L"Failed to set Avermedia encoder current res", hr);
return false;
}
hr = SetAVMEncoderSetting(propertySet,
AVER_PARAMETER_ENCODE_RESOLUTION,
ULONG(config.cx), ULONG(config.cy));
if (FAILED(hr)) {
WarningHR(L"Failed to set Avermedia encoder res", hr);
return false;
}
hr = SetAVMEncoderSetting(propertySet,
AVER_PARAMETER_ENCODE_GOP,
ULONG(config.keyframeInterval), 0);
if (FAILED(hr)) {
WarningHR(L"Failed to set Avermedia encoder GOP", hr);
return false;
}
return true;
}
示例10: STDMETHODIMP_
/*****************************************************************************
* CUnknown::NonDelegatingRelease()
*****************************************************************************
* Release a reference to the object without delegating to the outer unknown.
*/
STDMETHODIMP_(ULONG) CUnknown::NonDelegatingRelease(void)
{
ASSERT(m_lRefCount > 0);
if (InterlockedDecrement(&m_lRefCount) == 0)
{
m_lRefCount++;
delete this;
return 0;
}
return ULONG(m_lRefCount);
}
示例11: BankNames
void __cdecl BankNames(int i, char *Name)
{
unsigned rom_bank;
unsigned ram_bank;
bool IsRam = (RAM_BASE_M <= bankr[i]) && (bankr[i] < RAM_BASE_M + PAGE * MAX_RAM_PAGES);
bool IsRom = (ROM_BASE_M <= bankr[i]) && (bankr[i] < ROM_BASE_M + PAGE * MAX_ROM_PAGES);
if(IsRam)
ram_bank = ULONG((bankr[i] - RAM_BASE_M)/PAGE);
if(IsRom)
rom_bank = ULONG((bankr[i] - ROM_BASE_M)/PAGE);
if (IsRam)
sprintf(Name, "RAM%2X", ram_bank);
if (IsRom)
sprintf(Name, "ROM%2X", rom_bank);
if (bankr[i] == base_sos_rom)
strcpy(Name, "BASIC");
if (bankr[i] == base_dos_rom)
strcpy(Name, "TRDOS");
if (bankr[i] == base_128_rom)
strcpy(Name, "B128K");
if (bankr[i] == base_sys_rom && (conf.mem_model == MM_PROFSCORP || conf.mem_model == MM_SCORP))
strcpy(Name, "SVM ");
if ((conf.mem_model == MM_PROFSCORP || conf.mem_model == MM_SCORP) && IsRom && rom_bank > 3)
sprintf(Name, "ROM%2X", rom_bank);
if (bankr[i] == CACHE_M)
strcpy(Name, (conf.cache!=32)?"CACHE":"CACH0");
if (bankr[i] == CACHE_M+PAGE)
strcpy(Name, "CACH1");
}
示例12: GetNativeStack
StackVector GetNativeStack()
{
StackVector stackVector;
stackVector.resize(256);
ULONG filled;
HRESULT status = E_FAIL;
if ((status = g_Ext->m_Control5->GetStackTraceEx(0, 0, 0, &stackVector[0], ULONG(stackVector.size()), OUT &filled)) != S_OK)
{
g_Ext->ThrowRemote(status, "Unable to get callstack.");
}
stackVector.resize(filled);
return stackVector;
}
示例13: DbgLog
REFERENCE_TIME CAMSchedule::Advise( const REFERENCE_TIME & rtTime )
{
REFERENCE_TIME rtNextTime;
CAdvisePacket * pAdvise;
DbgLog((LOG_TIMING, 2,
TEXT("CAMSchedule::Advise( %lu ms )"), ULONG(rtTime / (UNITS / MILLISECONDS))));
CAutoLock lck(&m_Serialize);
#ifdef DEBUG
if (DbgCheckModuleLevel(LOG_TIMING, 4)) DumpLinkedList();
#endif
// Note - DON'T cache the difference, it might overflow
while ( rtTime >= (rtNextTime = (pAdvise=head.m_next)->m_rtEventTime) &&
!pAdvise->IsZ() )
{
ASSERT(pAdvise->m_dwAdviseCookie); // If this is zero, its the head or the tail!!
ASSERT(pAdvise->m_hNotify != INVALID_HANDLE_VALUE);
if (pAdvise->m_bPeriodic == TRUE)
{
ReleaseSemaphore(pAdvise->m_hNotify,1,NULL);
pAdvise->m_rtEventTime += pAdvise->m_rtPeriod;
ShuntHead();
}
else
{
ASSERT( pAdvise->m_bPeriodic == FALSE );
EXECUTE_ASSERT(SetEvent(pAdvise->m_hNotify));
--m_dwAdviseCount;
Delete( head.RemoveNext() );
}
}
DbgLog((LOG_TIMING, 3,
TEXT("CAMSchedule::Advise() Next time stamp: %lu ms, for advise %lu."),
DWORD(rtNextTime / (UNITS / MILLISECONDS)), pAdvise->m_dwAdviseCookie ));
return rtNextTime;
}
示例14: switch
void CSettingsDlg::OnOK()
{
CString tmp;
m_edtMaxMem.GetWindowTextW(tmp);
int k, i;
i = m_cmbUnits.GetCurSel();
switch (i)
{
case 0:
{
k = 1;
break;
}
case 1:
{
k = 1024;
break;
}
case 2:
{
k = 1024 * 1024;
break;
}
default:
{
k = 1;
}
}
m_MaxMem = ULONG(abs(_wtof(tmp.GetBuffer()) * k));
m_edtNumSteps.GetWindowTextW(tmp);
m_NumSteps = abs(_wtoi(tmp.GetBuffer()));
m_edtTimeStep.GetWindowTextW(tmp);
m_TimeStep = abs(_wtoi(tmp.GetBuffer()));
m_edtWidth.GetWindowTextW(tmp);
m_Width = abs(_wtoi(tmp.GetBuffer()));
m_edtHeight.GetWindowTextW(tmp);
m_Height = abs(_wtoi(tmp.GetBuffer()));
if ( (!m_MaxMem) || (!m_NumSteps) || (!m_TimeStep) || (!m_Width) || (!m_Height) )
{
MessageBox(L"Invalid values!", L"Error!", MB_ICONERROR);
return;
}
CDialog::OnOK();
}
示例15: VariantInit
HRESULT STDMETHODCALLTYPE QWindowsEnumerate::Next(unsigned long celt, VARIANT FAR* rgVar, unsigned long FAR* pCeltFetched)
{
if (pCeltFetched)
*pCeltFetched = 0;
ULONG l;
for (l = 0; l < celt; l++) {
VariantInit(&rgVar[l]);
if (current + 1 > ULONG(array.size())) {
*pCeltFetched = l;
return S_FALSE;
}
rgVar[l].vt = VT_I4;
rgVar[l].lVal = array[int(current)];
++current;
}
*pCeltFetched = l;
return S_OK;
}