本文整理汇总了C++中ARRAYSIZE函数 的典型用法代码示例。如果您正苦于以下问题:C++ ARRAYSIZE函数的具体用法?C++ ARRAYSIZE怎么用?C++ ARRAYSIZE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ARRAYSIZE函数 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetClientRect
// Create a DX11 context
//-----------------------------------------------------------------------------
CPUTResult CPUT_DX11::CreateDXContext(CPUTContextCreation ContextParams )
{
HRESULT hr = S_OK;
CPUTResult result = CPUT_SUCCESS;
// window params
RECT rc;
HWND hWnd = mpWindow->GetHWnd();
GetClientRect( hWnd, &rc );
UINT width = rc.right - rc.left;
UINT height = rc.bottom - rc.top;
// set up DirectX creation parameters
mdriverType = D3D_DRIVER_TYPE_NULL;
mfeatureLevel = D3D_FEATURE_LEVEL_11_0;
mpD3dDevice = NULL;
mpContext = NULL;
mpSwapChain = NULL;
mSwapChainBufferCount = ContextParams.swapChainBufferCount;
mpBackBufferRTV = NULL;
UINT createDeviceFlags = 0;
#ifdef _DEBUG
createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
D3D_DRIVER_TYPE driverTypes[] =
{
D3D_DRIVER_TYPE_HARDWARE,
D3D_DRIVER_TYPE_WARP,
D3D_DRIVER_TYPE_REFERENCE,
};
UINT numDriverTypes = ARRAYSIZE( driverTypes );
// SRV's (shader resource views) require Structured Buffer
// usage (D3D11_RESOURCE_MISC_BUFFER_STRUCTURED) which was
// introduced in shader model 5 (directx 11.0)
//
D3D_FEATURE_LEVEL featureLevels[] =
{
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0
};
UINT numFeatureLevels = ARRAYSIZE( featureLevels );
// swap chain information
DXGI_SWAP_CHAIN_DESC sd;
ZeroMemory( &sd, sizeof( sd ) );
sd.BufferCount = mSwapChainBufferCount;
sd.BufferDesc.Width = width;
sd.BufferDesc.Height = height;
mSwapChainFormat = ContextParams.swapChainFormat;
sd.BufferDesc.Format = ContextParams.swapChainFormat;
sd.BufferDesc.RefreshRate.Numerator = ContextParams.refreshRate;
sd.BufferDesc.RefreshRate.Denominator = 1;
sd.BufferUsage = ContextParams.swapChainUsage;
sd.OutputWindow = hWnd;
sd.SampleDesc.Count = 1; // Number of MSAA samples
sd.SampleDesc.Quality = 0;
sd.Windowed = TRUE;
sd.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
// set the vsync parameter
if(0 != ContextParams.refreshRate)
{
mSyncInterval = 1;
}
// walk devices and create device and swap chain on best matching piece of hardware
bool functionalityTestPassed = false;
for( UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; driverTypeIndex++ )
{
mdriverType = driverTypes[driverTypeIndex];
hr = D3D11CreateDeviceAndSwapChain(
NULL,
mdriverType,
NULL,
createDeviceFlags,
featureLevels,
numFeatureLevels,
D3D11_SDK_VERSION,
&sd,
&mpSwapChain,
&mpD3dDevice,
&mfeatureLevel,
&mpContext
);
if( SUCCEEDED( hr ) )
{
functionalityTestPassed = TestContextForRequiredFeatures();
if(true == functionalityTestPassed)
{
break;
}
else
{
//.........这里部分代码省略.........
开发者ID:GameTechDev, 项目名称:Windows-Desktop-Sensors, 代码行数:101, 代码来源:CPUT_DX11.cpp
示例2: sizeof
BOOL UpdateValidationX509::ValidateUpdate( MFUpdate* pUpdate, UINT8* pValidation, INT32 validationLen )
{
CK_MECHANISM_TYPE mechs[] = { CKM_RSA_PKCS };
CK_SLOT_ID slotID;
CK_SESSION_HANDLE session;
CK_OBJECT_CLASS ckoCert = CKO_CERTIFICATE;
CK_OBJECT_HANDLE hCACert;
CK_MECHANISM_TYPE sha1Mech = CKM_SHA_1;
CK_MECHANISM mech = { CKM_RSA_PKCS, &sha1Mech, sizeof(sha1Mech) };
BOOL retVal = FALSE;
UINT8* caCert;
UINT32 certLen = 0;
if(g_DebuggerPortSslConfig.GetCertificateAuthority == NULL)
{
return FALSE;
}
g_DebuggerPortSslConfig.GetCertificateAuthority( &caCert, &certLen );
CK_ATTRIBUTE attribs[] =
{
{ CKA_CLASS , &ckoCert, sizeof(ckoCert) },
{ CKA_VALUE , caCert , certLen }
};
if(pUpdate->Providers->Storage == NULL) return FALSE;
if(certLen == 0 || caCert == NULL ) return FALSE;
if(pValidation == NULL ) return FALSE;
C_Initialize(NULL);
slotID = Cryptoki_FindSlot(NULL, mechs, ARRAYSIZE(mechs)); if(CK_SLOT_ID_INVALID == slotID) return FALSE;
if(CKR_OK == C_OpenSession(slotID, CKF_SERIAL_SESSION, NULL, NULL, &session) && (CK_SESSION_HANDLE_INVALID != session))
{
if(CKR_OK == C_CreateObject(session, attribs, ARRAYSIZE(attribs), &hCACert) && hCACert != CK_OBJECT_HANDLE_INVALID)
{
if(CKR_OK == C_VerifyInit(session, &mech, hCACert))
{
UINT8 buff[512];
INT32 len = sizeof(buff);
INT32 updateSize = pUpdate->Header.UpdateSize;
INT32 offset = 0;
while(offset < updateSize)
{
if((offset + len) > updateSize)
{
len = updateSize - offset;
}
if(!pUpdate->Providers->Storage->Read(pUpdate->StorageHandle, offset, buff, len)) break;
C_VerifyUpdate(session, buff, len);
offset += len;
}
retVal = CKR_OK == C_VerifyFinal(session, pValidation, (CK_ULONG)validationLen);
}
C_DestroyObject(session, hCACert);
}
C_CloseSession(session);
}
return retVal;
}
开发者ID:EddieGarmon, 项目名称:netduino-netmf, 代码行数:69, 代码来源:X509UpdateValidation.cpp
示例3: freeSceneShapes
void KyraEngine_MR::freeSceneShapes() {
for (uint i = 0; i < ARRAYSIZE(_sceneShapes); ++i) {
delete[] _sceneShapes[i];
_sceneShapes[i] = 0;
}
}
开发者ID:AdamRi, 项目名称:scummvm-pink, 代码行数:6, 代码来源:scene_mr.cpp
示例4: key_path
RemoteDesktop::EventLog::EventLog(std::wstring name){
Name = name;
auto key_path(L"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\" + name);
HKEY key;
DWORD last_error = RegCreateKeyEx(HKEY_LOCAL_MACHINE,
key_path.c_str(),
0,
0,
REG_OPTION_NON_VOLATILE,
KEY_SET_VALUE,
0,
&key,
0);
if (ERROR_SUCCESS == last_error)
{
wchar_t szPath[MAX_PATH];
bool ret = false;
GetModuleFileName(NULL, szPath, ARRAYSIZE(szPath));
const DWORD types_supported = EVENTLOG_ERROR_TYPE |
EVENTLOG_WARNING_TYPE |
EVENTLOG_INFORMATION_TYPE;
RegSetValueEx(key,
L"EventMessageFile",
0,
REG_SZ,
(BYTE*)szPath,
wcsnlen_s(szPath, MAX_PATH) * 2);
RegSetValueEx(key,
L"CategoryMessageFile",
0,
REG_SZ,
(BYTE*)szPath,
wcsnlen_s(szPath, MAX_PATH) * 2);
RegSetValueEx(key,
L"ParameterMessageFile",
0,
REG_SZ,
(BYTE*)szPath,
wcsnlen_s(szPath, MAX_PATH) * 2);
RegSetValueEx(key,
L"TypesSupported",
0,
REG_DWORD,
(LPBYTE)&types_supported,
sizeof(types_supported));
DWORD catcount = 3;
RegSetValueEx(key,
L"CategoryCount",
0,
REG_DWORD,
(LPBYTE)&catcount,
sizeof(catcount));
RegCloseKey(key);
}
else
{
std::cerr << "Failed to install source: " << last_error << "\n";
}
_EventSource = RegisterEventSource(NULL, name.c_str());
}
开发者ID:gvsurenderreddy, 项目名称:RemoteDesktop-1, 代码行数:69, 代码来源:EventLog.cpp
示例5: DoWrap
void DoWrap(BOOL abWordWrap, EditorInfo &ei, int iMaxWidth)
{
INT_PTR iRc = 0;
INT_PTR cchMax = 0;
TCHAR* pszCopy = NULL;
TCHAR szEOL[4];
INT_PTR iFrom, iTo, iEnd, iFind;
bool bWasModifed = (ei.CurState & ECSTATE_MODIFIED) && !(ei.CurState & ECSTATE_SAVED);
gbLastWrap = TRUE;
for (INT_PTR i = 0; i < ei.TotalLines; i++)
{
//bool lbCurLine = (i == ei.CurLine);
EditorGetString egs = {FARSTRUCTSIZE(egs)};
egs.StringNumber = i;
iRc = EditCtrl(ECTL_GETSTRING, &egs);
if (!iRc)
{
_ASSERTE(iRc!=0);
goto wrap;
}
_ASSERTE(egs.StringText!=NULL);
if ((egs.StringLength <= iMaxWidth)
&& ((egs.StringLength <= 0) || !(egs.StringText && wcschr(egs.StringText, L'\t'))))
{
// Эту строку резать не нужно
continue;
}
lstrcpyn(szEOL, egs.StringEOL?egs.StringEOL:_T(""), ARRAYSIZE(szEOL));
if (egs.StringLength >= cchMax || !pszCopy)
{
if (pszCopy)
free(pszCopy);
cchMax = egs.StringLength + 255;
pszCopy = (TCHAR*)malloc(cchMax*sizeof(*pszCopy));
if (!pszCopy)
{
_ASSERTE(pszCopy!=NULL);
goto wrap;
}
}
// Делаем копию, над которой можем издеваться
memmove(pszCopy, egs.StringText, egs.StringLength*sizeof(*pszCopy));
pszCopy[egs.StringLength] = 0; // на всякий случай, хотя вроде должен быть ASCIIZ
bool lbFirst = 0;
iFrom = 0; iEnd = egs.StringLength;
while (iFrom < iEnd)
{
//iTo = min(iEnd,(iFrom+iMaxWidth));
iTo = FindExceed(pszCopy, i, iFrom, min(iEnd/*+1*/,(iFrom+iMaxWidth)), iMaxWidth, ei.TabSize);
iFind = iTo;
if (iFind >= iEnd)
{
iFind = iTo = iEnd;
}
else if (abWordWrap
/*&& (((egs.StringLength - iFrom) > iMaxWidth) || IsExceed(pszCopy, i, iFrom, iFind, iMaxWidth, ei.TabSize))*/
)
{
while (iFind > iFrom)
{
if (IsSpaceOrNull(pszCopy[iFind-1]))
break;
//{
// // Если есть табы - нужно учитывать их ширину
// //TODO: Optimize, по хорошему, если есть табы, нужно оптимизировать расчет экранной позиции
// bool bExceed = IsExceed(pszCopy, i, iFrom, iFind, iMaxWidth, ei.TabSize);
// if (!bExceed)
// break;
//}
iFind--;
}
// Если по пробелам порезать не удалось, попробуем по другим знакам?
if (iFind == iFrom)
{
iFind = iTo;
while (iFind > iFrom)
{
if (_tcschr(gsPuctuators, pszCopy[iFind]) && !_tcschr(gsWordDiv, pszCopy[iFind-1]))
break;
//{
// // Если есть табы - нужно учитывать их ширину
// //TODO: Optimize, по хорошему, если есть табы, нужно оптимизировать расчет экранной позиции
// bool bExceed = IsExceed(pszCopy, i, iFrom, iFind, iMaxWidth, ei.TabSize);
// if (!bExceed)
// break;
//}
iFind--;
}
if (iFind == iFrom)
{
iFind = iTo;
//.........这里部分代码省略.........
开发者ID:Maximus5, 项目名称:FarPlugins, 代码行数:101, 代码来源:EditWrap.cpp
示例6: ARRAYSIZE
static struct Rotation3AnimData r3ad_104E1AA8[] =
{
{ 0, { 0, 3345, -5139 } },
{ 15, { 0, 3345, -5139 } }
};
static struct Rotation3AnimData r3ad_104E1AC8[] =
{
{ 0, { 0, -3159, -5149 } },
{ 15, { 0, -3159, -5149 } }
};
static struct AnimFrame_PosRot afpr_104E1AE8[] =
{
{ v3ad_104E0684, NULL, ARRAYSIZE(v3ad_104E0684), 0 },
{ NULL, r3ad_104E06A8, 0, ARRAYSIZE(r3ad_104E06A8) },
{ NULL, NULL, 0, 0 },
{ NULL, NULL, 0, 0 },
{ NULL, NULL, 0, 0 },
{ NULL, r3ad_104E07A8, 0, ARRAYSIZE(r3ad_104E07A8) },
{ NULL, NULL, 0, 0 },
{ NULL, NULL, 0, 0 },
{ NULL, NULL, 0, 0 },
{ NULL, NULL, 0, 0 },
{ NULL, NULL, 0, 0 },
{ NULL, r3ad_104E08A8, 0, ARRAYSIZE(r3ad_104E08A8) },
{ NULL, r3ad_104E09A8, 0, ARRAYSIZE(r3ad_104E09A8) },
{ NULL, r3ad_104E0AA8, 0, ARRAYSIZE(r3ad_104E0AA8) },
{ NULL, NULL, 0, 0 },
{ NULL, NULL, 0, 0 },
开发者ID:sonicretro, 项目名称:sadx_decomp, 代码行数:30, 代码来源:ah2_104E1F28.c
示例7: wcePutFile
bool wcePutFile(const char *host_file, const char *wce_file)
{
TCHAR tszSrcFile[MAX_PATH];
WCHAR wszDestFile[MAX_PATH];
BYTE buffer[5120];
WIN32_FIND_DATA wfd;
HRESULT hr;
DWORD dwAttr, dwNumRead, dwNumWritten;
HANDLE hSrc, hDest, hFind;
int nResult;
#ifdef UNICODE
nResult = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
host_file, strlen(host_file)+1,
tszSrcFile, ARRAYSIZE(tszSrcFile));
if(0 == nResult)
return false;
#else
hr = StringCchCopy(tszSrcFile, ARRAYSIZE(tszSrcFile), argv[1]);
if(FAILED(hr))
return false;
#endif
nResult = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
wce_file, strlen(wce_file)+1,
wszDestFile, ARRAYSIZE(wszDestFile));
if(0 == nResult)
return false;
hFind = FindFirstFile( tszSrcFile, &wfd);
if (INVALID_HANDLE_VALUE == hFind) {
_tprintf(TEXT("Host file does not exist\n"));
return false;
}
FindClose( hFind);
if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
_tprintf( TEXT("Host file specifies a directory\n"));
return false;
}
if (wceConnect()) {
dwAttr = CeGetFileAttributes( wszDestFile);
if (dwAttr & FILE_ATTRIBUTE_DIRECTORY) {
hr = StringCchCatW(wszDestFile, ARRAYSIZE(wszDestFile), L"\\");
if(FAILED(hr)) return false;
#ifdef UNICODE
hr = StringCchCatW(wszDestFile, ARRAYSIZE(wszDestFile), wfd.cFileName);
if(FAILED(hr)) return false;
#else
nResult = MultiByteToWideChar(
CP_ACP,
MB_PRECOMPOSED,
wfd.cFileName,
strlen(wfd.cFileName)+1,
wszDestFile+wcslen(wszDestFile),
ARRAYSIZE(wszDestFile)-wcslen(wszDestFile));
if(0 == nResult)
{
return 1;
}
#endif
}
hSrc = CreateFile(tszSrcFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (INVALID_HANDLE_VALUE == hSrc) {
_tprintf( TEXT("Unable to open host file\n"));
return false;
}
hDest = CeCreateFile(wszDestFile, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (INVALID_HANDLE_VALUE == hDest ) {
_tprintf( TEXT("Unable to open target WinCE file\n"));
return false;
}
//copy file
do {
if(ReadFile(hSrc, &buffer, sizeof(buffer), &dwNumRead, NULL)) {
if (!CeWriteFile(hDest, &buffer, dwNumRead, &dwNumWritten, NULL)) {
_tprintf( TEXT("Error !!! Writing WinCE file\n"));
goto FatalError;
}
} else {
_tprintf( TEXT("Error !!! Reading host file\n"));
goto FatalError;
}
_tprintf( TEXT("."));
} while (dwNumRead);
//_tprintf( TEXT("\n"));
CeCloseHandle( hDest);
CloseHandle (hSrc);
}
wceDisconnect();
return true;
FatalError:
CeCloseHandle( hDest);
CloseHandle (hSrc);
wceDisconnect();
return false;
}
开发者ID:sanyaade-mobiledev, 项目名称:rhodes, 代码行数:100, 代码来源:detool.cpp
示例8: wf_post_connect
BOOL wf_post_connect(freerdp* instance)
{
rdpGdi* gdi;
DWORD dwStyle;
rdpCache* cache;
wfContext* wfc;
rdpContext* context;
WCHAR lpWindowName[64];
rdpSettings* settings;
EmbedWindowEventArgs e;
settings = instance->settings;
context = instance->context;
wfc = (wfContext*) instance->context;
cache = instance->context->cache;
wfc->dstBpp = 32;
wfc->width = settings->DesktopWidth;
wfc->height = settings->DesktopHeight;
if (wfc->sw_gdi)
{
gdi_init(instance, CLRCONV_ALPHA | CLRCONV_INVERT | CLRBUF_32BPP, NULL);
gdi = instance->context->gdi;
wfc->hdc = gdi->primary->hdc;
wfc->primary = wf_image_new(wfc, wfc->width, wfc->height, wfc->dstBpp, gdi->primary_buffer);
}
else
{
wf_gdi_register_update_callbacks(instance->update);
wfc->srcBpp = instance->settings->ColorDepth;
wfc->primary = wf_image_new(wfc, wfc->width, wfc->height, wfc->dstBpp, NULL);
wfc->hdc = gdi_GetDC();
wfc->hdc->bitsPerPixel = wfc->dstBpp;
wfc->hdc->bytesPerPixel = wfc->dstBpp / 8;
wfc->hdc->alpha = wfc->clrconv->alpha;
wfc->hdc->invert = wfc->clrconv->invert;
wfc->hdc->hwnd = (HGDI_WND) malloc(sizeof(GDI_WND));
wfc->hdc->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0);
wfc->hdc->hwnd->invalid->null = 1;
wfc->hdc->hwnd->count = 32;
wfc->hdc->hwnd->cinvalid = (HGDI_RGN) malloc(sizeof(GDI_RGN) * wfc->hdc->hwnd->count);
wfc->hdc->hwnd->ninvalid = 0;
if (settings->RemoteFxCodec)
{
wfc->tile = wf_image_new(wfc, 64, 64, 32, NULL);
wfc->rfx_context = rfx_context_new(FALSE);
}
if (settings->NSCodec)
{
wfc->nsc_context = nsc_context_new();
}
}
if (settings->WindowTitle != NULL)
_snwprintf(lpWindowName, ARRAYSIZE(lpWindowName), L"%S", settings->WindowTitle);
else if (settings->ServerPort == 3389)
_snwprintf(lpWindowName, ARRAYSIZE(lpWindowName), L"FreeRDP: %S", settings->ServerHostname);
else
_snwprintf(lpWindowName, ARRAYSIZE(lpWindowName), L"FreeRDP: %S:%d", settings->ServerHostname, settings->ServerPort);
if (settings->EmbeddedWindow)
settings->Decorations = FALSE;
if (!settings->Decorations)
dwStyle = WS_CHILD | WS_BORDER;
else
dwStyle = 0;
if (!wfc->hwnd)
{
wfc->hwnd = CreateWindowEx((DWORD) NULL, wfc->wndClassName, lpWindowName, dwStyle,
0, 0, 0, 0, wfc->hWndParent, NULL, wfc->hInstance, NULL);
SetWindowLongPtr(wfc->hwnd, GWLP_USERDATA, (LONG_PTR) wfc);
}
wf_resize_window(wfc);
wf_add_system_menu(wfc);
BitBlt(wfc->primary->hdc, 0, 0, wfc->width, wfc->height, NULL, 0, 0, BLACKNESS);
wfc->drawing = wfc->primary;
EventArgsInit(&e, "wfreerdp");
e.embed = FALSE;
e.handle = (void*) wfc->hwnd;
PubSub_OnEmbedWindow(context->pubSub, context, &e);
ShowWindow(wfc->hwnd, SW_SHOWNORMAL);
UpdateWindow(wfc->hwnd);
if (wfc->sw_gdi)
{
//.........这里部分代码省略.........
开发者ID:AhmadKabakibi, 项目名称:FreeRDP, 代码行数:101, 代码来源:wf_interface.c
示例9: ARRAYSIZE
{ -0.002852f, 0.988813f, 0.149136f },
{ 0.015325f, 0.108138f, -0.994018f }
};
static short unsigned int strips_10681990[] =
{
10,
7, 1, 3, 0, 2, 4, 6, 5, 7, 1
};
static struct MESH mesh_106819A8[] =
{
{ 0 | MeshPolyType_StripsB, 1, strips_10681990, 0, NULL, NULL, NULL, 0 }
};
extern struct MATERIAL mat_106804E8[1];
struct ATTACH attach_10681A88 =
{
vec3_106819C8,
vec3_10681A28,
ARRAYSIZE(vec3_106819C8),
mesh_106819A8,
mat_106804E8,
ARRAYSIZE(mesh_106819A8),
ARRAYSIZE(mat_106804E8),
{ 0.470043f, 0.006634f, -0.017387f },
0.829958f,
0
};
开发者ID:sonicretro, 项目名称:sadx_decomp, 代码行数:30, 代码来源:attach_10681A88.c
示例10: ExtendFileSystem
int ExtendFileSystem (HWND hwndDlg , wchar_t *lpszVolume, Password *pVolumePassword, int VolumePkcs5, int VolumePim, uint64 newDataAreaSize)
{
wchar_t szVolumeGUID[128];
int driveNo = -1;
wchar_t rootPath[] = L"A:\\";
enum EV_FileSystem fs;
DWORD dwError;
int nStatus = ERR_SUCCESS;
DWORD BytesPerSector;
// mount and resize file system
DebugAddProgressDlgStatus (hwndDlg, "Mounting volume ...\r\n");
nStatus=MountVolTemp(hwndDlg, lpszVolume, &driveNo, pVolumePassword, VolumePkcs5, VolumePim);
if (nStatus!=ERR_SUCCESS)
{
driveNo = -1;
goto error;
}
rootPath[0] += driveNo;
if ( !GetFileSystemType(rootPath,&fs) )
{
dwError = GetLastError();
if (dwError == ERROR_UNRECOGNIZED_VOLUME)
{
// raw volume with unrecognized file system -> return with no error
nStatus = ERR_SUCCESS;
goto error;
}
nStatus = ERR_OS_ERROR;
goto error;
}
if (fs != EV_FS_TYPE_RAW && fs != EV_FS_TYPE_NTFS )
{
// FsctlExtendVolume only supports NTFS and RAW -> return with no error
nStatus = ERR_SUCCESS;
goto error;
}
// Get volume GUID
if (!GetVolumeNameForVolumeMountPoint(rootPath,szVolumeGUID,ARRAYSIZE(szVolumeGUID)))
{
nStatus = ERR_OS_ERROR;
goto error;
}
else
{
// strip trailing backslash from volume GUID (otherwise it means root dir)
size_t len = wcslen(szVolumeGUID);
if (len>0) --len;
if (szVolumeGUID[len]==L'\\') szVolumeGUID[len]=0;
}
// Get Sector Size
if ( !GetNtfsNumberOfSectors(rootPath, NULL, &BytesPerSector) )
{
nStatus = ERR_OS_ERROR;
goto error;
}
DebugAddProgressDlgStatus (hwndDlg, "Extending file system ...\r\n");
// extend volume
nStatus = FsctlExtendVolume(szVolumeGUID, newDataAreaSize/BytesPerSector );
error:
dwError = GetLastError();
if (driveNo>=0)
{
DebugAddProgressDlgStatus (hwndDlg, "Unmounting volume ...\r\n");
UnmountVolume (hwndDlg, driveNo, TRUE);
}
SetLastError (dwError);
return nStatus;
}
开发者ID:goofwear, 项目名称:VeraCrypt, 代码行数:83, 代码来源:ExpandVolume.c
示例11: PowerOpsStateChange
static gboolean
PowerOpsStateChange(RpcInData *data)
{
size_t i;
PowerOpState *state = data->clientData;
if (state->pid != INVALID_PID) {
g_debug("State change already in progress.\n");
return RPCIN_SETRETVALS(data, "State change already in progress", FALSE);
}
g_debug("State change: %s\n", data->name);
for (i = 0; i < ARRAYSIZE(stateChangeCmdTable); i++) {
if (strcmp(data->name, stateChangeCmdTable[i].tcloCmd) == 0) {
gchar *script;
const char *result;
const char *confName;
Bool ret;
state->stateChgInProgress = stateChangeCmdTable[i].id;
/* Check for the toolScripts option. */
if (!state->scriptEnabled[stateChangeCmdTable[i].id]) {
PowerOpsStateChangeDone(state, TRUE);
g_debug("Script for %s not configured to run\n",
stateChangeCmdTable[i].tcloCmd);
return RPCIN_SETRETVALS(data, "", TRUE);
}
confName = stateChgConfNames[stateChangeCmdTable[i].id];
script = g_key_file_get_string(state->ctx->config,
"powerops",
confName,
NULL);
if (script == NULL) {
/* Use default script if not set in config file. */
const char *dfltScript = GuestApp_GetDefaultScript(confName);
if (dfltScript == NULL) {
g_debug("No default script to run for state change %s.\n",
stateChangeCmdTable[i].name);
PowerOpsStateChangeDone(state, TRUE);
return RPCIN_SETRETVALS(data, "", TRUE);
}
script = g_strdup(dfltScript);
} else if (strlen(script) == 0) {
g_debug("No script to run for state change %s.\n",
stateChangeCmdTable[i].name);
g_free(script);
PowerOpsStateChangeDone(state, TRUE);
return RPCIN_SETRETVALS(data, "", TRUE);
}
/* If script path is not absolute, assume the Tools install path. */
if (!g_path_is_absolute(script)) {
char *dfltPath;
char *tmp;
dfltPath = GuestApp_GetInstallPath();
ASSERT(dfltPath != NULL);
/*
* Before the switch to vmtoolsd, the config file was saved with
* quotes around the script path to make the old VMware dict code
* happy. Now we need to undo that when modifying the script path.
*
* PowerOpsRunScript will "re-quote" the script path.
*/
if (script[0] == '"') {
script[strlen(script) - 1] = '\0';
tmp = g_strdup_printf("%s%c%s", dfltPath, DIRSEPC, script + 1);
} else {
tmp = g_strdup_printf("%s%c%s", dfltPath, DIRSEPC, script);
}
g_free(script);
vm_free(dfltPath);
script = tmp;
}
if (PowerOpsRunScript(state, script)) {
result = "";
ret = TRUE;
} else {
PowerOpsStateChangeDone(state, FALSE);
result = "Error starting script";
ret = FALSE;
}
g_free(script);
return RPCIN_SETRETVALS(data, (char *) result, ret);
}
}
g_warning("Invalid state change command.\n");
return RPCIN_SETRETVALS(data, "Invalid state change command", FALSE);
}
开发者ID:AlissonGiron, 项目名称:open-vm-tools, 代码行数:98, 代码来源:powerOps.c
示例12: memcpy
void FTP::AddToQueque(FAR_FIND_DATA* FileName, LPCSTR Path, BOOL Download)
{
String str;
char *m;
int num;
FTPUrl* p = new FTPUrl;
memcpy(&p->Host, &Host, sizeof(Host));
p->Download = Download;
p->Next = NULL;
p->FileName = *FileName;
p->Error.Null();
p->DestPath = Path;
if(Download)
m = strrchr(FileName->cFileName, '/');
else
m = strrchr(FileName->cFileName, '\\');
if(m)
{
*m = 0;
p->DestPath.Add(m);
memmove(FileName->cFileName, m+1, m-FileName->cFileName);
}
if(Download)
{
GetCurPath(p->SrcPath);
AddEndSlash(p->SrcPath, '/');
str.printf("%s%s", p->SrcPath.c_str(), FileName->cFileName);
FixLocalSlash(p->DestPath);
AddEndSlash(p->DestPath, '\\');
num = str.Chr('/');
}
else
{
PanelInfo pi;
FP_Info->Control(this, FCTL_GETANOTHERPANELINFO, &pi);
p->SrcPath = pi.CurDir;
AddEndSlash(p->SrcPath, '\\');
str.printf("%s%s", p->SrcPath.c_str(), FileName->cFileName);
FixLocalSlash(str);
AddEndSlash(p->DestPath, '/');
num = str.Chr('\\');
}
if(num != -1)
{
StrCpy(p->FileName.cFileName, str.c_str()+num+1, ARRAYSIZE(p->FileName.cFileName));
str.SetLength(num);
p->SrcPath = str;
}
else
{
StrCpy(p->FileName.cFileName, str.c_str(), ARRAYSIZE(p->FileName.cFileName));
p->SrcPath.Null();
}
if(!UrlsList) UrlsList = p;
if(UrlsTail) UrlsTail->Next = p;
UrlsTail = p;
QuequeSize++;
}
开发者ID:CyberShadow, 项目名称:FAR, 代码行数:65, 代码来源:Queque.cpp
示例13: SetupQOpt
void FTP::QuequeMenu(void)
{
int n,
num;
int Breaks[] = { VK_DELETE, VK_INSERT, VK_F4, VK_RETURN, 0 },
BNumber;
FarMenuItem *mi = NULL;
FTPUrl* p,*p1;
char str1[MAX_PATH],
str2[MAX_PATH],
str3[MAX_PATH];
QueueExecOptions exOp;
SetupQOpt(&exOp);
num = -1;
do
{
mi = (FarMenuItem *)realloc(mi, (QuequeSize+1)*sizeof(FarMenuItem));
memset(mi, 0, QuequeSize*sizeof(FarMenuItem));
for(p = UrlsList,n = 0; p; p = p->Next, n++)
{
StrCpy(str1, p->SrcPath.c_str(), 20);
StrCpy(str2, p->DestPath.c_str(), 20);
StrCpy(str3, p->FileName.cFileName, 20);
_snprintf(mi[n].Text, ARRAYSIZE(mi[n].Text),
"%c%c %-20s%c%-20s%c%-20s",
p->Download ? '-' : '<', p->Download ? '>' : '-',
str1, FAR_VERT_CHAR,
str2, FAR_VERT_CHAR,
str3);
if(p->Error[0])
mi[n].Checked = TRUE;
}
//Title
char title[MAX_PATH];
_snprintf(title, ARRAYSIZE(title), "%s: %d %s", FP_GetMsg(MQMenuTitle), n, FP_GetMsg(MQMenuItems));
//Menu
if(num != -1 && num < QuequeSize) mi[num].Selected = TRUE;
n = FP_Info->Menu(FP_Info->ModuleNumber,-1,-1,0,FMENU_SHOWAMPERSAND,
title,
FP_GetMsg(MQMenuFooter),
"FTPQueue", Breaks, &BNumber, mi, QuequeSize);
//key ESC
if(BNumber == -1 &&
n == -1)
goto Done;
//key Enter
if(BNumber == -1)
{
//??
goto Done;
}
//Set selected
if(num != -1) mi[num].Selected = FALSE;
num = n;
//Process keys
switch(BNumber)
{
/*DEL*/
case 0:
if(QuequeSize)
switch(AskDeleteQueue())
{
case -1:
case 2:
break;
case 0:
p = UrlItem(n, &p1);
DeleteUrlItem(p, p1);
break;
case 1:
ClearQueue();
break;
}
break;
/*Ins*/
case 1:
InsertToQueue();
break;
/*F4*/
case 2:
p = UrlItem(n, NULL);
if(p)
EditUrlItem(p);
break;
/*Return*/
//.........这里部分代码省略.........
开发者ID:CyberShadow, 项目名称:FAR, 代码行数:101, 代码来源:Queque.cpp
示例14: ProgressSetStep
VOID
ProgressSetStep(
IN PPROGRESSBAR Bar,
IN ULONG Step)
{
COORD coPos;
DWORD Written;
ULONG NewPos;
CHAR TextBuffer[256];
if (Step > Bar->StepCount)
return;
Bar->CurrentStep = Step;
/* Update the progress and redraw it if it has changed */
if (Bar->UpdateProgressProc &&
Bar->UpdateProgressProc(Bar, FALSE, TextBuffer, ARRAYSIZE(TextBuffer)))
{
coPos.X = Bar->Left + (Bar->Width - strlen(TextBuffer) + 1) / 2;
coPos.Y = Bar->Top;
WriteConsoleOutputCharacterA(StdOutput,
TextBuffer,
strlen(TextBuffer),
coPos,
&Written);
}
/* Calculate the bar position */
NewPos = (((Bar->Width - 2) * 2 * Bar->CurrentStep + (Bar->StepCount / 2)) / Bar->StepCount);
/* Redraw the bar if it has changed */
if (Bar->Pos != NewPos)
{
Bar->Pos = NewPos;
for (coPos.Y = Bar->Top + 2; coPos.Y <= Bar->Bottom - 1; coPos.Y++)
{
coPos.X = Bar->Left + 1;
FillConsoleOutputCharacterA(StdOutput,
0xDB,
Bar->Pos / 2,
coPos,
&Written);
coPos.X += Bar->Pos / 2;
if (NewPos & 1)
{
FillConsoleOutputCharacterA(StdOutput,
0xDD,
1,
coPos,
&Written);
coPos.X++;
}
if (coPos.X <= Bar->Right - 1)
{
FillConsoleOutputCharacterA(StdOutput,
' ',
Bar->Right - coPos.X,
coPos,
&Written);
}
}
}
}
开发者ID:Moteesh, 项目名称:reactos, 代码行数:67, 代码来源:progress.c
示例15: stuff
u32 stuff( AtomicBitSet( &StuffToDo, ~job, 0x00000000 ) );
if( stuff == 0 )
{
Dynarec_ClearedCPUStuffToDo();
}
}
#ifdef DAEDALUS_ENABLE_SYNCHRONISATION
static const char * const kRegisterNames[] =
{
"zr", "at", "v0", "v1", "a0", "a1", "a2", "a3",
"t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
"s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
"t8", "t9", "k0", "k1", "gp", "sp", "fp", "ra"
};
DAEDALUS_STATIC_ASSERT(ARRAYSIZE(kRegisterNames) == 32);
void SCPUState::Dump()
{
DBGConsole_Msg(0, "Emulation CPU State:");
{
for(int i=0; i<32; i+=4)
{
DBGConsole_Msg(0, "%s:%08X %s:%08X %s:%08X %s:%08X",
kRegisterNames[i+0], gCPUState.CPU[i+0]._u32_0,
kRegisterNames[i+1], gCPUState.CPU[i+1]._u32_0,
kRegisterNames[i+2], gCPUState.CPU[i+2]._u32_0,
kRegisterNames[i+3], gCPUState.CPU[i+3]._u32_0);
}
DBGConsole_Msg(0, "TargetPC: %08x", gCPUState.TargetPC);
开发者ID:ThePhoenixRises, 项目名称:daedalus, 代码行数:31, 代码来源:CPU.cpp
示例16: ARRAYSIZE
#endif
{ WLC_E_WAKE_EVENT, "WAKE_EVENT" },
{ WLC_E_DCS_REQUEST, "DCS_REQUEST" },
{ WLC_E_RM_COMPLETE, "RM_COMPLETE" },
#ifdef WLMEDIA_HTSF
{ WLC_E_HTSFSYNC, "HTSF_SYNC_EVENT" },
#endif
{ WLC_E_OVERLAY_REQ, "OVERLAY_REQ_EVENT" },
{ WLC_E_CSA_COMPLETE_IND, "WLC_E_CSA_COMPLETE_IND"},
{ WLC_E_EXCESS_PM_WAKE_EVENT, "EXCESS_PM_WAKE_EVENT" },
{ WLC_E_PFN_SCAN_NONE, "PFN_SCAN_NONE" },
{ WLC_E_PFN_SCAN_ALLGONE, "PFN_SCAN_ALLGONE" },
#ifdef SOFTAP
{ WLC_E_GTK_PLUMBED, "GTK_PLUMBED" },
#endif
{ WLC_E_ASSOC_REQ_IE, "ASSOC_REQ_IE" },
{ WLC_E_ASSOC_RESP_IE, "ASSOC_RESP_IE" },
#ifdef WLTDLS
{ WLC_E_TDLS_PEER_EVENT, "TDLS_PEER_EVENT" },
#endif /* WLTDLS */
{ WLC_E_NATIVE, "NATIVE" },
#ifdef WLPKTDLYSTAT
{ WLC_E_PKTDELAY_IND, "PKTDELAY_IND" },
#endif /* WLPKTDLYSTAT */
{ WLC_E_SERVICE_FOUND, "SERVICE_FOUND" },
{ WLC_E_GAS_FRAGMENT_RX, "GAS_FRAGMENT_RX" },
{ WLC_E_GAS_COMPLETE, "GAS_COMPLETE" }
};
const int bcmevent_names_size = ARRAYSIZE(bcmevent_names);
开发者ID:jameshilliard, 项目名称:broadcom-hnd, 代码行数:30, 代码来源:bcmevent.c
示例17: ARRAYSIZE
// Fail Schedule
//=========================================================
Task_t tlAssassinFail[] =
{
{ TASK_STOP_MOVING, 0 },
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },
{ TASK_WAIT_FACE_ENEMY, (float)2 },
// { TASK_WAIT_PVS, (float)0 },
{ TASK_SET_SCHEDULE, (float)SCHED_CHASE_ENEMY },
};
Schedule_t slAssassinFail[] =
{
{
tlAssassinFail,
ARRAYSIZE ( tlAssassinFail ),
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE |
bits_COND_PROVOKED |
bits_COND_CAN_RANGE_ATTACK1 |
bits_COND_CAN_RANGE_ATTACK2 |
bits_COND_CAN_MELEE_ATTACK1 |
bits_COND_HEAR_SOUND,
bits_SOUND_DANGER |
bits_SOUND_PLAYER,
"AssassinFail"
},
};
开发者ID:Fograin, 项目名称:hl-subsmod-ex, 代码行数:29, 代码来源:monster_human_assassin.cpp
示例18: SHCoCreateInstance
STDAPI SHCoCreateInstance(LPCTSTR pszCLSID, const CLSID * pclsid,
LPUNKNOWN pUnkOuter, REFIID riid, LPVOID FAR* ppv)
{
HRESULT hres = ResultFromScode(REGDB_E_CLASSNOTREG);
CLSID clsidT;
TCHAR szClass[GUIDSTR_MAX+ARRAYSIZE(c_szInProcServer)];
if (pclsid)
{
if (!pszCLSID)
{
StringFromGUID2A(pclsid, szClass, ARRAYSIZE(szClass));
}
}
else
{
if (pszCLSID)
{
lstrcpy(szClass,pszCLSID);
if (SUCCEEDED(SHCLSIDFromString(pszCLSID, &clsidT)))
pclsid=&clsidT;
}
}
if (pclsid)
{
LONG err;
HKEY hkeyDll;
IClassFactory *pCF;
Assert(hres == ResultFromScode(REGDB_E_CLASSNOTREG));
lstrcat(szClass,c_szInProcServer); // Add "\InProcServer32"
hres = _FindRegisteredClass(pclsid, &pCF);
if (SUCCEEDED(hres))
{
hres = pCF->lpVtbl->CreateInstance(pCF, pUnkOuter, riid, ppv);
pCF->lpVtbl->Release(pCF);
}
else
{
if (g_hkcrCLSID && RegOpenKey(g_hkcrCLSID, szClass, &hkeyDll) == ERROR_SUCCESS)
{
TCHAR szDllName[MAX_PATH];
LONG cbValue = SIZEOF(szDllName);
// 1 2 3
// 012345678901234567890123456789012345678 = nul is at 38!
// "{12345678-1234-1234-1234-123456789012}"
//
szClass[38] = TEXT('\0'); // Get rid of "\InProcServer32"
err = RegQueryValue(hkeyDll, NULL, szDllName, &cbValue);
#ifdef WINNT
//
// On NT, we must check to ensure that this CLSID exists in
// the list of approved CLSIDs that can be used in-process.
// If not, we fail the creation with ERROR_ACCESS_DENIED.
// We explicitly allow anything serviced by this DLL
//
if (err == ERROR_SUCCESS && NULL != g_hklmApprovedExt)
{
TCHAR szBuf[MAX_PATH];
//
// Check to see if we are using this DLL
//
// BUGBUG Assumes no parameters in InProcServer32. We
// should remove this assumption once we lose shellalt,
// after which we can just lstrcpyn(,,<length of dll name>);
LPCTSTR pszDllName = PathFindFileName(szDllName);
if (lstrcmp(pszDllName, TEXT("shell32.dll")) &&
lstrcmp(pszDllName, TEXT("shellalt.dll")))
{
DWORD dwType;
TCHAR szValue[MAX_PATH];
DWORD cbSize = SIZEOF(szValue);
if (ERROR_SUCCESS != RegQueryValueEx(g_hklmApprovedExt,
szClass,
0,
&dwType,
(LPBYTE) szValue,
&cbSize))
{
hres = HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED);
return hres;
}
}
}
#endif
if (err == ERROR_SUCCESS)
{
//.........这里部分代码省略.........
开发者ID:mingpen, 项目名称:OpenNT, 代码行数:101, 代码来源:ole2dup.c
示例19: ARRAYSIZE
static struct Rotation3AnimData r3ad_101C24A0[] =
{
{ 0, { 0, 0, -32767 } },
{ 31, { 0, 0, -32767 } }
};
static struct Rotation3AnimData r3ad_101C24C0[] =
{
{ 0, { 0, -12315, 32735 } },
{ 31, { 0, -12315, 32735 } }
};
static struct AnimFrame_PosRot afpr_101C24E0[] =
{
{ v3ad_101C0A6C, NULL, ARRAYSIZE(v3ad_101C0A6C), 0 },
{ NULL, NULL, 0, 0 },
{ NULL, NULL, 0, 0 },
{ NULL, r3ad_101C0A8C, 0, ARRAYSIZE(r3ad_101C0A8C) },
{ NULL, r3ad_101C0AAC, 0, ARRAYSIZE(r3ad_101C0AAC) },
{ NULL, r3ad_101C0ACC, 0, ARRAYSIZE(r3ad_101C0ACC) },
{ NULL, NULL, 0, 0 },
{ NULL, r3ad_101C0AF0, 0, ARRAYSIZE(r3ad_101C0AF0) },
{ NULL, r3ad_101C0CF0, 0, ARRAYSIZE(r3ad_101C0CF0) },
{ NULL, NULL, 0, 0 },
{ NULL, NULL, 0, 0 },
{ NULL, r3ad_101C0EF0, 0, ARRAYSIZE(r3ad_101C0EF0) },
{ NULL, r3ad_101C0F10, 0, ARRAYSIZE(r3ad_101C0F10) },
{ NULL, r3ad_101C0F30, 0, ARRAYSIZE(r3ad_101C0F30) },
{ NULL, NULL, 0, 0 },
{ NULL, NULL, 0, 0 },
开发者ID:sonicretro, 项目名称:sadx_decomp, 代码行数:30, 代码来源:ah2_101C2970.c
示例20: Cvar_DirectSet_internal
六六分期app的软件客服如何联系?不知道吗?加qq群【895510560】即可!标题:六六分期
阅读:19126| 2023-10-27
今天小编告诉大家如何处理win10系统火狐flash插件总是崩溃的问题,可能很多用户都不知
阅读:9971| 2022-11-06
今天小编告诉大家如何对win10系统删除桌面回收站图标进行设置,可能很多用户都不知道
阅读:8317| 2022-11-06
今天小编告诉大家如何对win10系统电脑设置节能降温的设置方法,想必大家都遇到过需要
阅读:8686| 2022-11-06
我们在使用xp系统的过程中,经常需要对xp系统无线网络安装向导设置进行设置,可能很多
阅读:8626| 2022-11-06
今天小编告诉大家如何处理win7系统玩cf老是与主机连接不稳定的问题,可能很多用户都不
阅读:9643| 2022-11-06
电脑对日常生活的重要性小编就不多说了,可是一旦碰到win7系统设置cf烟雾头的问题,很
阅读:8611| 2022-11-06
我们在日常使用电脑的时候,有的小伙伴们可能在打开应用的时候会遇见提示应用程序无法
阅读:7991| 2022-11-06
今天小编告诉大家如何对win7系统打开vcf文件进行设置,可能很多用户都不知道怎么对win
阅读:8640| 2022-11-06
今天小编告诉大家如何对win10系统s4开启USB调试模式进行设置,可能很多用户都不知道怎
阅读:7527| 2022-11-06
请发表评论