本文整理汇总了C++中LPBYTE函数的典型用法代码示例。如果您正苦于以下问题:C++ LPBYTE函数的具体用法?C++ LPBYTE怎么用?C++ LPBYTE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LPBYTE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddURLToDownload
BOOL AddURLToDownload (LPCSTR pszUrl, LPCSTR pszReferer, LPCSTR pszComment, BOOL bAutoStart)
{
DWORD dwErr;
HKEY key;
static int _iKey = 0;
char szKey [1000];
wsprintf (szKey, "URLsToDownload\\FdmSetupInstaller_%d", _iKey++);
dwErr = RegCreateKey (_hFDMKey, szKey, &key);
if (dwErr != ERROR_SUCCESS && dwErr)
return FALSE;
RegSetValueEx (key, "URL", NULL, REG_SZ, LPBYTE (pszUrl), lstrlen (pszUrl));
RegSetValueEx (key, "Referer", NULL, REG_SZ, LPBYTE (pszReferer), lstrlen (pszReferer));
RegSetValueEx (key, "Comment", NULL, REG_SZ, LPBYTE (pszComment), lstrlen (pszComment));
DWORD dw = TRUE;
RegSetValueEx (key, "Silent", NULL, REG_DWORD, (LPBYTE)&dw, sizeof (dw));
RegSetValueEx (key, "zlr", 0, REG_DWORD, (LPBYTE)&dw, sizeof (dw));
if (bAutoStart)
dw = TRUE;
else
dw = FALSE;
RegSetValueEx (key, "AutoStart", NULL, REG_DWORD, (LPBYTE)&dw, sizeof (dw));
RegCloseKey (key);
return TRUE;
}
示例2: ASSERT
void CClientContext::OnRecvDataCompleted( DWORD dwIOSize )
{
CString strLog;
ASSERT(m_cRecvDataBuffer != NULL);
m_dwReceivedSize += dwIOSize;
m_i64RecvCnt++;
strLog.Format(_T("GTM:[1]m_dwPacketSize=%d,m_dwReceivedSize=%d,dwIOSize=%d,"),m_dwPacketSize,m_dwReceivedSize,dwIOSize);
//OutputDebugString(strLog);
//printf("recv[%x]_%I64d,iosize=%d---total=%d\r\n",this,m_i64RecvCnt,dwIOSize,m_dwReceivedSize);
char * pData = m_iIO.databuf.buf;
pData[dwIOSize] = '\0';
//strLog.Format()
// if (m_dwReceivedSize < m_dwPacketSize)
// {
// AsyncRecvBody(m_dwPacketSize - m_dwReceivedSize);
// }
// else if (m_dwReceivedSize == m_dwPacketSize)
{
strLog.Format(_T("GTM:[2]m_dwPacketSize=%d,m_dwReceivedSize=%d,dwIOSize=%d"),m_dwPacketSize,m_dwReceivedSize,dwIOSize);
//OutputDebugString(strLog);
strLog.Format(_T("Server have received a msg(%d).Socket=%d. OnRecvBodyCompleted"),m_dwPacketSize,m_s);
//WriteLog(SERVERLOGNAME, _T("OnRecvBodyCompleted"), strLog);
if (m_pRecvCBFunc != NULL)
{
m_pRecvCBFunc(STATUS_OK,LPBYTE(this), LPBYTE(pData), dwIOSize, m_pRecvCBUserData);
}
else
{
WriteLog(SERVERLOGNAME, logLevelWarring, _T("m_pRecvCBFunc == NULL when OnRecvBodyCompleted!"));
}
//必须也用m_CallBackLock保护,防止在析构里同时释放内存池
// if(!m_pMemPool->ReleaseBuffer(m_pRecvBufferCell,1))
// {
// strLog.Format(_T("m_pMemPool->ReleaseBuffer failed. Socket=%d"), m_s);
// WriteLog(SERVERLOGNAME,logLevelWarring, strLog);
// }
// m_pRecvBufferCell = NULL;
AsyncRecvData();
}
// else
// {
// strLog.Format(_T("GTM:[3]m_dwPacketSize=%d,m_dwReceivedSize=%d,dwIOSize=%d"),m_dwPacketSize,m_dwReceivedSize,dwIOSize);
// //OutputDebugString(strLog);
// }
}
示例3: decodeBuffer
void* CCrypt::decodeBuffer(const BYTE *pBuf, size_t bufLen, size_t *cbResultLen)
{
if (cbResultLen)
*cbResultLen = 0;
if (!m_valid || pBuf == NULL || (bufLen % BLOCK_SIZE) != 0)
return NULL;
char *result = (char*)mir_alloc(bufLen + 1);
if (decrypt_cbc(m_ctx, LPBYTE(pBuf), (BYTE*)result, bufLen)) {
mir_free(result);
return NULL;
}
result[bufLen] = 0;
WORD cbLen = *(PWORD)result;
if (cbLen > bufLen) {
mir_free(result);
return NULL;
}
memmove(result, result + 2, cbLen);
if (cbResultLen)
*cbResultLen = cbLen;
return result;
}
示例4: DWORD
bool
CExampleDlg::SaveSetting(HKEY key, LPCTSTR pcName, LPCTSTR pcValue)
{
DWORD nBytes = DWORD(sizeof(TCHAR) * (_tcslen(pcValue) + 1));
return RegSetValueEx(key, pcName, 0, REG_SZ, LPBYTE(pcValue),
nBytes) == ERROR_SUCCESS;
}
示例5: RegQueryValueEx
bool
CExampleDlg::LoadSetting(HKEY key, LPCTSTR pcName, LPTSTR pcValue,
DWORD nValueSize)
{
return RegQueryValueEx(key, pcName, 0, 0, LPBYTE(pcValue),
&nValueSize) == ERROR_SUCCESS;
}
示例6: LPBYTE
//--------------------------------------------------------------------------------
CNTService::~CNTService()
{
AFX_MANAGE_STATE_IF_DLL
g_this = NULL;
delete[] LPBYTE(m_pUserSID);
}
示例7: while
HRESULT CLZMA::ReadPart(void *data, UINT32 size, UINT32 *processedSize)
{
if (processedSize)
*processedSize = 0;
while (size)
{
if (!avail_in)
{
if (finish)
{
return S_OK;
}
GetMoreIO();
if (!avail_in)
{
if (finish)
{
return S_OK;
}
return E_ABORT;
}
if (compressor_finished)
return E_ABORT;
}
UINT32 l = std::min(size, avail_in);
memcpy(data, next_in, l);
avail_in -= l;
size -= l;
next_in += l;
data = LPBYTE(data) + l;
if (processedSize)
*processedSize += l;
}
return S_OK;
}
示例8: LPBYTE
bool pws_os::RegReadSTValue(const TCHAR *name, stringT &value)
{
if (!bSubTreeKeyValid)
return bSubTreeKeyValid;
bool retval = false;
LONG rv;
DWORD dwType, DataLen;
rv = ::RegQueryValueEx(hSubTreeKey,
name,
NULL,
&dwType,
NULL,
&DataLen);
if (rv == ERROR_SUCCESS && dwType == REG_SZ) {
DataLen++;
TCHAR *pData = new TCHAR[DataLen];
::memset(pData, 0, DataLen);
rv = ::RegQueryValueEx(hSubTreeKey,
name,
NULL,
&dwType,
LPBYTE(pData),
&DataLen);
if (rv == ERROR_SUCCESS) {
value = pData;
retval = true;
}
delete[] pData;
}
return retval;
}
示例9: data
QPCSCReader::Result QPCSCReader::transfer( const QByteArray &cmd ) const
{
static const SCARD_IO_REQUEST T0 = { 1, 8 };
static const SCARD_IO_REQUEST T1 = { 2, 8 };
QByteArray data( 255 + 3, 0 );
DWORD size = data.size();
qDebug() << "Send:" << cmd.toHex();
DWORD ret = SCardTransmit( d->card, d->proto == SCARD_PROTOCOL_T0 ? &T0 : &T1,
LPCBYTE(cmd.constData()), cmd.size(), 0, LPBYTE(data.data()), &size );
if( ret != SCARD_S_SUCCESS )
{
qDebug() << "Err:" << ret;
return Result();
}
Result result( data.mid( size-2, 2 ), data.left( size - 2 ) );
qDebug() << "Recv:" << result.first.toHex() << result.second.toHex();
if( result.first.at( 0 ) == 0x61 )
{
QByteArray cmd( "\x00\xC0\x00\x00\x00", 5 );
cmd[4] = data.at( size-1 );
return transfer( cmd );
}
return result;
}
示例10: sizeof
HGLOBAL POTraceCtl::CreateDropFilesW(const String& strUrl)
{
int nBufferSize = sizeof(DROPFILES) + sizeof(wchar) * (strUrl.GetLength() + 1) + sizeof(wchar);
// Allocate memory from the heap for the DROPFILES struct.
HGLOBAL hgDrop = GlobalAlloc( GHND | GMEM_SHARE, nBufferSize);
if( NULL == hgDrop )
return 0;
DROPFILES* pDrop = (DROPFILES*) GlobalLock(hgDrop);
if( NULL == pDrop )
{
GlobalFree(hgDrop);
return 0;
}
pDrop->pFiles = sizeof(DROPFILES);
pDrop->fWide = TRUE;
wchar* pszBuff = (wchar*) (LPBYTE(pDrop) + sizeof(DROPFILES));
chustd::Memory::Copy16(pszBuff, strUrl.GetBuffer(), strUrl.GetLength() + 1);
GlobalUnlock(hgDrop);
return hgDrop;
}
示例11: IsClassNet
// ////////////////////////////////////////////////////////////////////////////////
// @private IsClassNet
//
static BOOL IsClassNet( GUID * ClassGuid )
{
#define MAX_NUM 50
HKEY hKeyClass;
LONG lRet;
WCHAR ClassType[MAX_NUM];
WCHAR NetClass[MAX_NUM] = L"Net";
DWORD dwLength = MAX_NUM,dwType = REG_SZ;
if (hKeyClass = SetupDiOpenClassRegKey(ClassGuid,KEY_READ))
{
lRet = RegQueryValueExW(
hKeyClass,
L"Class",
NULL,
&dwType,
LPBYTE(ClassType),
&dwLength);
RegCloseKey(hKeyClass);
if ( lRet != ERROR_SUCCESS )
{
return FALSE;
}
if ( !wcscmp(ClassType,NetClass) )
{
return TRUE;
}
}
return FALSE;
}
示例12: LPBYTE
CHtmlStream& CHtmlStream::operator<<(const CLongBinary& blob)
{
if (blob.m_dwDataLength > 0 && blob.m_hData != NULL)
{
LPBYTE pbData = LPBYTE( GlobalLock(blob.m_hData) );
if (pbData != NULL )
{
UINT_PTR nBytesLeft;
nBytesLeft = blob.m_dwDataLength;
while( nBytesLeft > 0 )
{
UINT nBytesToWrite;
nBytesToWrite = (UINT)min( nBytesLeft, INT_MAX );
Write(pbData, nBytesToWrite);
nBytesLeft -= nBytesToWrite;
pbData += nBytesToWrite;
}
GlobalUnlock( blob.m_hData );
}
}
return *this;
}
示例13: ProcessImage
void ProcessImage(HBITMAP image)
{
return;
DIBSECTION dibsection = {0};
int nBytes = 0;
nBytes = ::GetObject( image, sizeof( DIBSECTION ), &dibsection );
if( nBytes == sizeof( DIBSECTION ) )
{
size_t width = dibsection.dsBmih.biWidth;
size_t height = abs( dibsection.dsBmih.biHeight );
size_t BPP = dibsection.dsBmih.biBitCount;
if( BPP != 32 )
return;
void *bits = dibsection.dsBm.bmBits;
size_t pitch = (((width * BPP) + 31) / 32) * 4;
for(size_t i = 0; i != width; ++i)
{
for(size_t j = 0; j < height; ++j)
{
LPBYTE pucColor = LPBYTE( bits )+(j*pitch)+((i*BPP)/8);
pucColor[0] = pucColor[0] * pucColor[3] / 255;
pucColor[1] = pucColor[1] * pucColor[3] / 255;
pucColor[2] = pucColor[2] * pucColor[3] / 255;
}
}
}
else
assert(0);
}
示例14: SAFE_DELETE_ARRAY
fsInternetResult fsHttpFiles::LoadFile()
{
UINT uToRead = 1000;
const FLOAT fInc = 1.2f;
fsInternetResult ir;
UINT64 uFileSize = m_httpFile.GetFileSize ();
UINT64 uMax = uFileSize;
UINT64 uPos = 0;
DWORD dwRead;
if (uMax == _UI64_MAX)
uMax = 100000;
SAFE_DELETE_ARRAY (m_pszFileBuffer);
fsnew (m_pszFileBuffer, char, int (uMax+1));
int cZeroReads = 0;
do
{
if (uToRead > uFileSize - uPos)
uToRead = UINT (uFileSize - uPos);
if (uPos + uToRead > uMax)
{
uMax = UINT64 ((INT64)uMax * fInc);
LPSTR psz = 0;
fsnew (psz, char, int (uMax+1));
CopyMemory (psz, m_pszFileBuffer, UINT (uPos));
delete [] m_pszFileBuffer;
m_pszFileBuffer = psz;
}
ir = m_httpFile.Read (LPBYTE (m_pszFileBuffer+uPos), uToRead, &dwRead);
if (ir != IR_SUCCESS)
{
delete m_pszFileBuffer;
return ir;
}
uPos += dwRead;
if (dwRead == 0)
{
cZeroReads ++;
if (cZeroReads < 3 && uFileSize != _UI64_MAX)
dwRead = 1;
}
else
cZeroReads = 0;
}
示例15: RegSetValueEx
void NewDeviceWidget::onSetButtonClicked()
{
//Check whether the Device Name is of appropriate length
if (deviceNameInput->text().count() < 1 || deviceNameInput->text().count() > 16) //1 - 16 is the valid length range
{
deviceNameLabel->setText("The device name must be between 1-12 characters:");
deviceNameLabel->setPalette(errorTextPalette);
}
else
{
/* Save this Device Name and Type to the Registry */
HKEY inssidiousHKCU;
if (ERROR_SUCCESS == RegCreateKeyEx(HKEY_CURRENT_USER, L"Software\\Inssidious\\DevicePairs", 0, 0, 0, KEY_WRITE, 0, &inssidiousHKCU, 0))
{
RegSetValueEx(
inssidiousHKCU,
QString(MAC + "-Name").toStdWString().c_str(),
0,
REG_SZ,
LPBYTE(deviceNameInput->text().utf16()),
deviceNameInput->text().size() * sizeof(wchar_t)
);
RegSetValueEx(
inssidiousHKCU,
QString(MAC + "-Type").toStdWString().c_str(),
0,
REG_SZ,
LPBYTE(deviceTypeComboBox->currentText().utf16()),
deviceTypeComboBox->currentText().size() * sizeof(wchar_t)
);
}
/* Send out the name and type values */
emit setDeviceInfo(MAC, deviceNameInput->text(), deviceTypeComboBox->currentText());
}
}