• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PtrToUlong函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中PtrToUlong函数的典型用法代码示例。如果您正苦于以下问题:C++ PtrToUlong函数的具体用法?C++ PtrToUlong怎么用?C++ PtrToUlong使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了PtrToUlong函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: CreateConsole

void CreateConsole()
{
	AllocConsole();

	HANDLE lStdHandle = GetStdHandle(STD_OUTPUT_HANDLE);
	int hConHandle = _open_osfhandle(PtrToUlong((ULONG)lStdHandle), _O_TEXT);
	FILE* fp = _fdopen(hConHandle, "w");
	*stdout = *fp;
	setvbuf(stdout, NULL, _IONBF, 0);

	lStdHandle = GetStdHandle(STD_INPUT_HANDLE);
	hConHandle = _open_osfhandle(PtrToUlong((ULONG)lStdHandle), _O_TEXT);
	fp = _fdopen(hConHandle, "r");
	*stdin = *fp;
	setvbuf(stdin, NULL, _IONBF, 0);

	lStdHandle = GetStdHandle(STD_ERROR_HANDLE);
	hConHandle = _open_osfhandle(PtrToUlong((ULONG)lStdHandle), _O_TEXT);
	fp = _fdopen(hConHandle, "w");
	*stderr = *fp;
	setvbuf(stderr, NULL, _IONBF, 0);
	::SetConsoleMode( lStdHandle, ENABLE_ECHO_INPUT );

	char szStr[64] = {0};
	sprintf_s( szStr, "vIrtuaL W0rLd - Build: %s %s", __DATE__, __TIME__ );
	SetConsoleTitleA( szStr );
}
开发者ID:ItsClemi,项目名称:MyWorld,代码行数:27,代码来源:dllmain.cpp


示例2: get_input_bytes

static bool /* knows nothing about records!  Only about input buffers */
get_input_bytes(RECSTREAM *rstrm, char *addr, int len)
{
	size_t current;

	if (rstrm->nonblock) {
		if (len > (int)(rstrm->in_boundry - rstrm->in_finger))
			return false;
		memcpy(addr, rstrm->in_finger, (size_t) len);
		rstrm->in_finger += len;
		return true;
	}

	while (len > 0) {
		current =
		    (size_t) (PtrToUlong(rstrm->in_boundry) -
			      PtrToUlong(rstrm->in_finger));
		if (current == 0) {
			if (!fill_input_buf(rstrm))
				return (false);
			continue;
		}
		current = (len < current) ? len : current;
		memmove(addr, rstrm->in_finger, current);
		rstrm->in_finger += current;
		addr += current;
		len -= current;
	}
	return (true);
}
开发者ID:hkoehler,项目名称:ntirpc,代码行数:30,代码来源:xdr_rec.c


示例3: BlockedThreadHandler

DWORD WINAPI BlockedThreadHandler(PVOID pvParam) {
  
   HANDLE hParentThread;
   DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), 
      GetCurrentProcess(), &hParentThread, 0, FALSE, 
      DUPLICATE_SAME_ACCESS);
   HANDLE handles[3];
   DWORD threadID1;
   handles[0] = CreateThread(NULL, 0, SimpleThreadHandler, 
      hParentThread, 0, &threadID1);
   DWORD threadID2;
   handles[1] = CreateThread(NULL, 0, SimpleThreadHandler, 
      hParentThread, 0, &threadID2);
   DWORD threadID3;
   handles[2] = CreateThread(NULL, 0, SimpleThreadHandler, 
      hParentThread, 0, &threadID3);
   
   _tprintf(TEXT("LockThreads = %u\n"), GetCurrentThreadId());
   _tprintf(TEXT("   thread1 = %u (0x%x)\n"), threadID1, PtrToUlong(handles[0]));
   _tprintf(TEXT("   thread2 = %u (0x%x)\n"), threadID2, PtrToUlong(handles[1]));
   _tprintf(TEXT("   thread3 = %u (0x%x)\n"), threadID3, PtrToUlong(handles[2]));

   Sleep(100);

   // Note: WaitForMultipleObjects is not handled by WCT
   WaitForMultipleObjects(3, handles, TRUE, INFINITE);   
   //WaitForSingleObject(handles[0], INFINITE);   

   _tprintf(TEXT("LockThreads is over\n"));
   
   return(0);
}
开发者ID:Jeanhwea,项目名称:WindowsViaCPP,代码行数:32,代码来源:BadLock.cpp


示例4: CreateConsole

void CreateConsole(const char *winTitle)
{
	//http://www.gamedev.net/community/forums/viewreply.asp?ID=1958358
	int hConHandle = 0;
	HANDLE lStdHandle = 0;
	FILE *fp = 0 ;

	AllocConsole();
	if(winTitle)
		SetConsoleTitleA(winTitle);

	// redirect unbuffered STDOUT to the console
	lStdHandle = GetStdHandle(STD_OUTPUT_HANDLE);
	hConHandle = _open_osfhandle(PtrToUlong(lStdHandle), _O_TEXT);
	fp = _fdopen(hConHandle, "w");
	*stdout = *fp;
	setvbuf(stdout, NULL, _IONBF, 0);

	// redirect unbuffered STDIN to the console
	lStdHandle = GetStdHandle(STD_INPUT_HANDLE);
	hConHandle = _open_osfhandle(PtrToUlong(lStdHandle), _O_TEXT);
	fp = _fdopen(hConHandle, "r");
	*stdin = *fp;
	setvbuf(stdin, NULL, _IONBF, 0);

	// redirect unbuffered STDERR to the console
	lStdHandle = GetStdHandle(STD_ERROR_HANDLE);
	hConHandle = _open_osfhandle(PtrToUlong(lStdHandle), _O_TEXT);
	fp = _fdopen(hConHandle, "w");
	*stderr = *fp;
	setvbuf(stderr, NULL, _IONBF, 0);
}
开发者ID:ProjectHax,项目名称:DivisionInfo,代码行数:32,代码来源:main.cpp


示例5: FollowNPC_Enable

VOID FollowNPC_Enable(PBYTE pFollowNpc1, PBYTE pFollowNpc2, PBYTE pFollowFaction, PFLOAT pFollowNPCDistance, BOOL bEnable)
{
	DWORD dwOldProtect;
	if(pFollowNpc1 && pFollowNpc2 && VirtualProtect(pFollowNpc1, PtrToUlong(pFollowNpc2) - PtrToUlong(pFollowNpc1) + 1, PAGE_EXECUTE_READWRITE, &dwOldProtect))
	{
		if(bEnable)
		{
			if(pFollowNpc1[0] != 0x90)
			{
				memcpy(g_bFollowNpcBackup1, pFollowNpc1, sizeof(g_bFollowNpcBackup1));
				memcpy(g_bFollowNpcBackup2, pFollowNpc2, sizeof(g_bFollowNpcBackup2));
			}
			memcpy(pFollowNpc1, g_bNop, sizeof(g_bFollowNpcBackup1));
			memcpy(pFollowNpc2, g_bNop, sizeof(g_bFollowNpcBackup2));
		}
		else
		{
			if(pFollowNpc1[0] == 0x90)
			{
				memcpy(pFollowNpc1, g_bFollowNpcBackup1, sizeof(g_bFollowNpcBackup1));
				memcpy(pFollowNpc2, g_bFollowNpcBackup2, sizeof(g_bFollowNpcBackup2));
			}
		}
		VirtualProtect(pFollowNpc1, PtrToUlong(pFollowNpc2) - PtrToUlong(pFollowNpc1) + 1, dwOldProtect, &dwOldProtect);
	}
	if(pFollowFaction && VirtualProtect(pFollowFaction, sizeof(g_bFollowNpcBackup3), PAGE_EXECUTE_READWRITE, &dwOldProtect))
	{
		if(bEnable)
		{
			if(pFollowFaction[0] != 0x90)
			{
				memcpy(g_bFollowNpcBackup3, pFollowFaction, sizeof(g_bFollowNpcBackup3));
			}
			memcpy(pFollowFaction, g_bNop, sizeof(g_bFollowNpcBackup3));
		}
		else
		{
			if(pFollowFaction[0] == 0x90)
			{
				memcpy(pFollowFaction, g_bFollowNpcBackup3, sizeof(g_bFollowNpcBackup3));
			}
		}
		VirtualProtect(pFollowFaction, sizeof(g_bFollowNpcBackup3), dwOldProtect, &dwOldProtect);
	}
	if(pFollowNPCDistance && VirtualProtect(pFollowNPCDistance, sizeof(FLOAT), PAGE_READWRITE, &dwOldProtect))
	{
		if(bEnable)
		{
			*(PDWORD)pFollowNPCDistance = 0x7F800000;
		}
		else
		{
			*pFollowNPCDistance = 900;
		}
		VirtualProtect(pFollowNPCDistance, sizeof(FLOAT), dwOldProtect, &dwOldProtect);
	}

}
开发者ID:ohio813,项目名称:bwh14,代码行数:58,代码来源:follownpc.cpp


示例6: DrvSetPrinterData16

/******************************************************************
 *                 DrvSetPrinterData     (GDI.281)
 *
 */
DWORD WINAPI DrvSetPrinterData16(LPSTR lpPrinter, LPSTR lpProfile,
                               DWORD lpType, LPBYTE lpPrinterData,
                               DWORD dwSize)
{
    LPSTR RegStr_Printer;
    HKEY hkey = 0;
    DWORD res = 0;

    if (HIWORD(lpPrinter))
            TRACE("printer %s\n",lpPrinter);
    else
            TRACE("printer %p\n",lpPrinter);
    if (HIWORD(lpProfile))
            TRACE("profile %s\n",lpProfile);
    else
            TRACE("profile %p\n",lpProfile);
    TRACE("lpType %08x\n",lpType);

    if ((!lpPrinter) || (!lpProfile) ||
    (PtrToUlong(lpProfile) == INT_PD_DEFAULT_MODEL) || (HIWORD(lpProfile) &&
    (!strcmp(lpProfile, PrinterModel))))
	return ERROR_INVALID_PARAMETER;

    RegStr_Printer = HeapAlloc(GetProcessHeap(), 0,
			strlen(Printers) + strlen(lpPrinter) + 2);
    strcpy(RegStr_Printer, Printers);
    strcat(RegStr_Printer, lpPrinter);

    if ((PtrToUlong(lpProfile) == INT_PD_DEFAULT_DEVMODE) || (HIWORD(lpProfile) &&
    (!strcmp(lpProfile, DefaultDevMode)))) {
	if ( RegOpenKeyA(HKEY_LOCAL_MACHINE, RegStr_Printer, &hkey)
	     != ERROR_SUCCESS ||
	     RegSetValueExA(hkey, DefaultDevMode, 0, REG_BINARY,
			      lpPrinterData, dwSize) != ERROR_SUCCESS )
	        res = ERROR_INVALID_PRINTER_NAME;
    }
    else
    {
	strcat(RegStr_Printer, "\\");

	if( (res = RegOpenKeyA(HKEY_LOCAL_MACHINE, RegStr_Printer, &hkey)) ==
	    ERROR_SUCCESS ) {

	    if (!lpPrinterData)
	        res = RegDeleteValueA(hkey, lpProfile);
	    else
                res = RegSetValueExA(hkey, lpProfile, 0, lpType,
				       lpPrinterData, dwSize);
	}
    }

    if (hkey) RegCloseKey(hkey);
    HeapFree(GetProcessHeap(), 0, RegStr_Printer);
    return res;
}
开发者ID:Jactry,项目名称:wine,代码行数:59,代码来源:printdrv.c


示例7: scanSendChatMessage_ScanProc

VOID scanSendChatMessage_ScanProc(INT iItem, HWND hwndDlg, PBYTE pbFile)
{
	PIMAGE_NT_HEADERS pNtHdr = PIMAGE_NT_HEADERS(pbFile + PIMAGE_DOS_HEADER(pbFile)->e_lfanew);
    PIMAGE_SECTION_HEADER pSecHdr = PIMAGE_SECTION_HEADER(pNtHdr + 1);
    PBYTE pbCode = RvaToPointer(pbFile, pSecHdr[0].VirtualAddress);
    DWORD dwCodeSize = pSecHdr[0].SizeOfRawData;
	PBYTE pbRData = RvaToPointer(pbFile, pSecHdr[1].VirtualAddress);
	DWORD dwRDataSize = pSecHdr[1].SizeOfRawData;
	PBYTE pbData = RvaToPointer(pbFile, pSecHdr[2].VirtualAddress);
    DWORD dwDataSize = pSecHdr[2].SizeOfRawData;
	
	SetItemStatus(iItem, hwndDlg, "Scanning...");

	// scan data section for "Unknown chat type"
	for(DWORD dwDataIndex = 0; dwDataIndex < dwDataSize - (sizeof("Unknown chat type") - 1); dwDataIndex++)
	{
		if(MemoryCompare(&pbData[dwDataIndex], (PBYTE)"Unknown chat type", sizeof("Unknown chat type") - 1))
		{
			// calculate va of found string
			DWORD dwStringVA = OffsetToRva(pbFile, PtrToUlong(pbData) + dwDataIndex - PtrToUlong(pbFile));
			if(dwStringVA)
			{
				dwStringVA += pNtHdr->OptionalHeader.ImageBase;

				// scan code section for 'push dwStringVA'
				for(DWORD dwCodeIndex = 0; dwCodeIndex < dwCodeSize - 8; dwCodeIndex++)
				{
					if(pbCode[dwCodeIndex] == 0x68 && *((PDWORD)&pbCode[dwCodeIndex + 1]) == dwStringVA)
					{
						// find beginning of procedure
						for(DWORD dwCodeIndex2 = dwCodeIndex & 0xFFFFFFF0; dwCodeIndex2; dwCodeIndex2 -= 0x10)
						{
							if(pbCode[dwCodeIndex2 - 1] == 0x90 || pbCode[dwCodeIndex2 - 1] == 0xC3 || pbCode[dwCodeIndex2 - 3] == 0xC2)
							{
								DWORD dwProcRva = OffsetToRva(pbFile, PtrToUlong(pbCode) + dwCodeIndex2 - PtrToUlong(pbFile));
								if(dwProcRva)
								{
									GetPPD(iItem, hwndDlg)->dwValue = dwProcRva + pNtHdr->OptionalHeader.ImageBase;
									SetItemStatus(iItem, hwndDlg, "Success");
									return;
								}
							}
						}
					}
				}
			}
		}
	}
	GetPPD(iItem, hwndDlg)->dwValue = 0;
	SetItemStatus(iItem, hwndDlg, "Fail");
}
开发者ID:ohio813,项目名称:bwh14,代码行数:51,代码来源:scan_sendchatmessage.cpp


示例8: XenUsb_CompleteXenbusInit

static NTSTATUS
XenUsb_CompleteXenbusInit(PXENUSB_DEVICE_DATA xudd) {
  PUCHAR ptr;
  USHORT type;
  PCHAR setting, value, value2;
  ULONG i;

  ptr = xudd->config_page;
  while((type = GET_XEN_INIT_RSP(&ptr, (PVOID)&setting, (PVOID)&value, (PVOID)&value2)) != XEN_INIT_TYPE_END) {
    switch(type) {
    case XEN_INIT_TYPE_RING: /* frontend ring */
      FUNCTION_MSG("XEN_INIT_TYPE_RING - %s = %p\n", setting, value);
      if (strcmp(setting, "urb-ring-ref") == 0) {
        xudd->urb_sring = (usbif_urb_sring_t *)value;
        FRONT_RING_INIT(&xudd->urb_ring, xudd->urb_sring, PAGE_SIZE);
      }
      if (strcmp(setting, "conn-ring-ref") == 0) {
        xudd->conn_sring = (usbif_conn_sring_t *)value;
        FRONT_RING_INIT(&xudd->conn_ring, xudd->conn_sring, PAGE_SIZE);
      }
      break;
    case XEN_INIT_TYPE_EVENT_CHANNEL_DPC: /* frontend event channel */
      FUNCTION_MSG("XEN_INIT_TYPE_EVENT_CHANNEL_DPC - %s = %d\n", setting, PtrToUlong(value) & 0x3FFFFFFF);
      if (strcmp(setting, "event-channel") == 0) {
        xudd->event_channel = PtrToUlong(value);
      }
      break;
    case XEN_INIT_TYPE_READ_STRING_BACK:
    case XEN_INIT_TYPE_READ_STRING_FRONT:
      FUNCTION_MSG("XEN_INIT_TYPE_READ_STRING - %s = %s\n", setting, value);
      break;
    default:
      FUNCTION_MSG("XEN_INIT_TYPE_%d\n", type);
      break;
    }
  }
  if (xudd->urb_sring == NULL || xudd->conn_sring == NULL || xudd->event_channel == 0) {
    FUNCTION_MSG("Missing settings\n");
    FUNCTION_EXIT();
    return STATUS_BAD_INITIAL_PC;
  }
  
  stack_new(&xudd->req_id_ss, REQ_ID_COUNT);
  for (i = 0; i < REQ_ID_COUNT; i++)  {
    put_id_on_freelist(xudd->req_id_ss, (uint16_t)i);
  }
  
  return STATUS_SUCCESS;
}
开发者ID:alexp206,项目名称:win-pvdrivers-mirror,代码行数:49,代码来源:xenusb_fdo.c


示例9: SetWindowLongPtr

LRESULT CALLBACK DemoApp::s_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    DemoApp *pThis;
    LRESULT lRet = 0;

    if (uMsg == WM_NCCREATE)
    {
        LPCREATESTRUCT pcs = reinterpret_cast<LPCREATESTRUCT> (lParam);
        pThis = reinterpret_cast<DemoApp *> (pcs->lpCreateParams);

        SetWindowLongPtr(hWnd, GWLP_USERDATA, PtrToUlong(pThis));
        lRet = DefWindowProc(hWnd, uMsg, wParam, lParam);
    }
    else
    {
        pThis = reinterpret_cast<DemoApp *> (GetWindowLongPtr(hWnd, GWLP_USERDATA));
        if (pThis)
        {
            lRet = pThis->WndProc(hWnd, uMsg, wParam, lParam);
        }
        else
        {
            lRet = DefWindowProc(hWnd, uMsg, wParam, lParam);
        }
    }

    return lRet;
}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:28,代码来源:WICProgressiveDecoding.cpp


示例10: PtrToUlong

LRESULT CALLBACK SnakeD2D::WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    LRESULT result = 0;
    bool wasHandled = false;

    if (message == WM_CREATE)
    {
        LPCREATESTRUCT pcs = (LPCREATESTRUCT)lParam;
        SnakeD2D *app = (SnakeD2D*)pcs->lpCreateParams;

        ::SetWindowLongPtrW(
            hwnd,
            GWLP_USERDATA,
            PtrToUlong(app)
        );
    }
    else
    {
        SnakeD2D *app = reinterpret_cast<SnakeD2D *>(static_cast<LONG_PTR>(
                            ::GetWindowLongPtrW(
                                hwnd,
                                GWLP_USERDATA
                            )));
        switch(message)
        {
        case WM_KEYDOWN:
            switch(wParam)
            {
            case VK_ESCAPE:
                PostQuitMessage(0);
                break;
            default:
                break;
            }
            wasHandled = true;
            break;
        default:
            break;
        case WM_PAINT:
            ValidateRect(hwnd, nullptr); // avoid new wm_paint messages
            wasHandled = true;
            result = 0;
            break;
        case WM_SIZE:
        {
            UINT width = LOWORD(lParam);
            UINT height = HIWORD(lParam);
            app->OnResize(width, height);
        }
        result = 0;
        wasHandled = true;
        break;
        }
    }

    if(!wasHandled)
        result = DefWindowProc(hwnd, message, wParam, lParam);

    return result;
}
开发者ID:jimmy2saints,项目名称:SnakeD2D,代码行数:60,代码来源:SnakeD2D.cpp


示例11: LockCriticalSections

void LockCriticalSections() {

   InitializeCriticalSection(&cs1);
   InitializeCriticalSection(&cs2);

   DWORD threadID1;
   CreateThread(NULL, 0, LockCriticalSectionHandler, (PVOID)1, 0, &threadID1);
   DWORD threadID2;
   CreateThread(NULL, 0, LockCriticalSectionHandler, (PVOID)2, 0, &threadID2);
   
   _tprintf(TEXT("LockCriticalSections:\n"));
   _tprintf(TEXT("   thread1 = %u\n"), threadID1);
   _tprintf(TEXT("   thread2 = %u\n"), threadID2);
   _tprintf(TEXT("   &cs1 = 0x%x\n"), PtrToUlong(&cs1));
   _tprintf(TEXT("   &cs2 = 0x%x\n"), PtrToUlong(&cs2));
}
开发者ID:Jeanhwea,项目名称:WindowsViaCPP,代码行数:16,代码来源:BadLock.cpp


示例12: ControlPadWndProc

LRESULT CALLBACK ControlPadWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{

	if (Msg == WM_CREATE)
	{
		// Pointer to a value to be passed to the window through 
		// the CREATESTRUCT structure is out window object instance.
		LPCREATESTRUCT pcs = (LPCREATESTRUCT)lParam;
		ControlPad* pCtrlPad = static_cast<ControlPad*>(pcs->lpCreateParams);
		// Store the pointer as private data of the window
		::SetWindowLongPtr(hWnd, GWLP_USERDATA, PtrToUlong(pCtrlPad)); 
		pCtrlPad->Attach(hWnd);
		pCtrlPad->OnCreate();
		return 0;
	}

	// Extract the pointer to out window object
	ControlPad* pCtrlPad = static_cast<ControlPad*>(UlongToPtr(::GetWindowLongPtr(hWnd, GWLP_USERDATA)));

	if (pCtrlPad)
	{
		pCtrlPad->WindowProc(Msg, wParam, lParam);
	}
	return DefWindowProc(hWnd, Msg, wParam, lParam);

}
开发者ID:alexshag,项目名称:FSQAR,代码行数:26,代码来源:ControlPad.cpp


示例13: PhGetServiceNameFromTag

PPH_STRING PhGetServiceNameFromTag(
    _In_ HANDLE ProcessId,
    _In_ PVOID ServiceTag
    )
{
    static PQUERY_TAG_INFORMATION I_QueryTagInformation = NULL;
    PPH_STRING serviceName = NULL;
    TAG_INFO_NAME_FROM_TAG nameFromTag;

    if (!I_QueryTagInformation)
    {
        I_QueryTagInformation = PhGetModuleProcAddress(L"advapi32.dll", "I_QueryTagInformation");

        if (!I_QueryTagInformation)
            return NULL;
    }

    memset(&nameFromTag, 0, sizeof(TAG_INFO_NAME_FROM_TAG));
    nameFromTag.InParams.dwPid = HandleToUlong(ProcessId);
    nameFromTag.InParams.dwTag = PtrToUlong(ServiceTag);

    I_QueryTagInformation(NULL, eTagInfoLevelNameFromTag, &nameFromTag);

    if (nameFromTag.OutParams.pszName)
    {
        serviceName = PhCreateString(nameFromTag.OutParams.pszName);
        LocalFree(nameFromTag.OutParams.pszName);
    }

    return serviceName;
}
开发者ID:Azarien,项目名称:processhacker2,代码行数:31,代码来源:svcsup.c


示例14: PtrToUlong

// Worker Thread Start Routine
DWORD 
CDeviceGeneralPage::OnWorkerThreadStart(LPVOID lpParameter)
{
	UINT i = PtrToUlong(lpParameter);

	ATLASSERT(i < RTL_NUMBER_OF(m_pUnitDevices));
	if (i >= RTL_NUMBER_OF(m_pUnitDevices))
	{
		return 255;
	}

	ndas::UnitDevicePtr pUnitDevice = m_pUnitDevices[i];
	if (NULL == pUnitDevice.get())
	{
		return 1;
	}

	(void) pUnitDevice->UpdateHostStats();

	if (::IsWindow(m_hWnd))
	{
		ATLVERIFY(PostMessage(WM_USER_DONE, 0, static_cast<LPARAM>(i)));
	}

	return 0;
}
开发者ID:tigtigtig,项目名称:ndas4windows,代码行数:27,代码来源:devpropsh.cpp


示例15: ComboBoxSelected

//-----------------------------------------------------------------------------
// Name: MultisampleTypeChanged
// Desc: Respond to a change of selected multisample type.
//-----------------------------------------------------------------------------
void CD3DSettingsDialog::MultisampleTypeChanged( void )
{
    D3DMULTISAMPLE_TYPE mst = (D3DMULTISAMPLE_TYPE)PtrToUlong( ComboBoxSelected( IDC_MULTISAMPLE_COMBO ) );
    m_d3dSettings.SetMultisampleType( mst );

    // Set up max quality for this mst
    D3DDeviceCombo* pDeviceCombo = m_d3dSettings.PDeviceCombo();
    DWORD maxQuality = 0;

    for( UINT ims = 0; ims < pDeviceCombo->pMultiSampleTypeList->Count(); ims++ )
    {
        D3DMULTISAMPLE_TYPE msType = *(D3DMULTISAMPLE_TYPE*)pDeviceCombo->pMultiSampleTypeList->GetPtr(ims);
        if( msType == mst )
        {
            maxQuality = *(DWORD*)pDeviceCombo->pMultiSampleQualityList->GetPtr(ims);
            break;
        }
    }

    ComboBoxClear( IDC_MULTISAMPLE_QUALITY_COMBO );
    for( UINT msq = 0; msq < maxQuality; msq++ )
    {
        TCHAR str[100];
        wsprintf( str, TEXT("%d"), msq );
        ComboBoxAdd( IDC_MULTISAMPLE_QUALITY_COMBO, UlongToPtr( msq ), str );
        if( msq == m_d3dSettings.MultisampleQuality() )
            ComboBoxSelect( IDC_MULTISAMPLE_QUALITY_COMBO, UlongToPtr( msq ) );
    }
    if (!ComboBoxSomethingSelected( IDC_MULTISAMPLE_QUALITY_COMBO ) && 
        ComboBoxCount( IDC_MULTISAMPLE_QUALITY_COMBO ) > 0)
    {
        ComboBoxSelectIndex( IDC_MULTISAMPLE_QUALITY_COMBO, 0 );
    }
}
开发者ID:xahgo,项目名称:tama,代码行数:38,代码来源:d3dsettings.cpp


示例16: FillRect

/*
 * @implemented
 */
INT WINAPI
FillRect(HDC hDC, CONST RECT *lprc, HBRUSH hbr)
{
    BOOL Ret;
    HBRUSH prevhbr = NULL;

    /* Select brush if specified */
    if (hbr)
    {
        /* Handle system colors */
        if (hbr <= (HBRUSH)(COLOR_MENUBAR + 1))
            hbr = GetSysColorBrush(PtrToUlong(hbr) - 1);

        prevhbr = SelectObject(hDC, hbr);
        if (prevhbr == NULL)
            return (INT)FALSE;
    }

    Ret = PatBlt(hDC, lprc->left, lprc->top, lprc->right - lprc->left,
                 lprc->bottom - lprc->top, PATCOPY);

    /* Select old brush */
    if (prevhbr)
        SelectObject(hDC, prevhbr);

    return (INT)Ret;
}
开发者ID:RPG-7,项目名称:reactos,代码行数:30,代码来源:draw.c


示例17: kull_m_token_getTokens_process_callback

BOOL CALLBACK kull_m_token_getTokens_process_callback(PSYSTEM_PROCESS_INFORMATION pSystemProcessInformation, PVOID pvArg)
{
	BOOL status = TRUE;
	HANDLE hProcess, hToken;
	
	if(hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, PtrToUlong(pSystemProcessInformation->UniqueProcessId)))
	{
		if(OpenProcessToken(hProcess, TOKEN_QUERY | TOKEN_DUPLICATE, &hToken))
		{
			status = ((PKULL_M_TOKEN_ENUM_DATA) pvArg)->callback(hToken, PtrToUlong(pSystemProcessInformation->UniqueProcessId), ((PKULL_M_TOKEN_ENUM_DATA) pvArg)->pvArg);
			CloseHandle(hToken);
		}
		CloseHandle(hProcess);
	}
	return (((PKULL_M_TOKEN_ENUM_DATA) pvArg)->mustContinue = status);
}
开发者ID:0xbadjuju,项目名称:mimikatz,代码行数:16,代码来源:kull_m_token.c


示例18: HID_Device_read

NTSTATUS WINAPI HID_Device_read(DEVICE_OBJECT *device, IRP *irp)
{
    HID_XFER_PACKET *packet;
    BASE_DEVICE_EXTENSION *ext = device->DeviceExtension;
    UINT buffer_size = RingBuffer_GetBufferSize(ext->ring_buffer);
    NTSTATUS rc = STATUS_SUCCESS;
    IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation(irp);
    int ptr = -1;

    packet = HeapAlloc(GetProcessHeap(), 0, buffer_size);
    ptr = PtrToUlong( irp->Tail.Overlay.OriginalFileObject->FsContext );

    irp->IoStatus.Information = 0;
    RingBuffer_ReadNew(ext->ring_buffer, ptr, packet, &buffer_size);

    if (buffer_size)
    {
        IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation( irp );
        NTSTATUS rc;
        ULONG out_length;
        packet->reportBuffer = (BYTE *)packet + sizeof(*packet);
        TRACE_(hid_report)("Got Packet %p %i\n", packet->reportBuffer, packet->reportBufferLen);

        rc = copy_packet_into_buffer(packet, irp->AssociatedIrp.SystemBuffer, irpsp->Parameters.Read.Length, &out_length);
        irp->IoStatus.Information = out_length;
        irp->IoStatus.u.Status = rc;
        IoCompleteRequest(irp, IO_NO_INCREMENT);
    }
    else
    {
        BASE_DEVICE_EXTENSION *extension = device->DeviceExtension;
        if (extension->poll_interval)
        {
            TRACE_(hid_report)("Queue irp\n");
            InsertTailList(&ext->irp_queue, &irp->Tail.Overlay.s.ListEntry);
            rc = STATUS_PENDING;
        }
        else
        {
            HID_XFER_PACKET packet;
            TRACE("No packet, but opportunistic reads enabled\n");
            packet.reportId = ((BYTE*)irp->AssociatedIrp.SystemBuffer)[0];
            packet.reportBuffer = &((BYTE*)irp->AssociatedIrp.SystemBuffer)[1];
            packet.reportBufferLen = irpsp->Parameters.Read.Length - 1;
            rc = call_minidriver(IOCTL_HID_GET_INPUT_REPORT, device, NULL, 0, &packet, sizeof(packet));

            if (rc == STATUS_SUCCESS)
            {
                ((BYTE*)irp->AssociatedIrp.SystemBuffer)[0] = packet.reportId;
                irp->IoStatus.Information = packet.reportBufferLen + 1;
                irp->IoStatus.u.Status = rc;
            }
            IoCompleteRequest(irp, IO_NO_INCREMENT);
        }
    }
    HeapFree(GetProcessHeap(), 0, packet);

    return rc;
}
开发者ID:iXit,项目名称:wine,代码行数:59,代码来源:device.c


示例19: PtrToUlong

//-----------------------------------------------------------------------------
// Name: ResolutionChanged
// Desc: Respond to a change of selected resolution by rebuilding the
//       refresh rate list.
//-----------------------------------------------------------------------------
void CD3DSettingsDialog::ResolutionChanged( void )
{
    if (m_d3dSettings.IsWindowed)
        return;

    D3DAdapterInfo* pAdapterInfo = (D3DAdapterInfo*)ComboBoxSelected( IDC_ADAPTER_COMBO );
    if( pAdapterInfo == NULL )
        return;

    // Update settingsNew with new resolution
    DWORD dwResolutionData = PtrToUlong( ComboBoxSelected( IDC_RESOLUTION_COMBO ) );
    UINT width = LOWORD( dwResolutionData );
    UINT height = HIWORD( dwResolutionData );
    m_d3dSettings.Fullscreen_DisplayMode.Width = width;
    m_d3dSettings.Fullscreen_DisplayMode.Height = height;

    // Update refresh rate list based on new resolution
    D3DFORMAT adapterFormat = (D3DFORMAT)PtrToUlong( ComboBoxSelected( IDC_ADAPTERFORMAT_COMBO ) );
    ComboBoxClear( IDC_REFRESHRATE_COMBO );
    for( UINT idm = 0; idm < pAdapterInfo->pDisplayModeList->Count(); idm++ )
    {
        D3DDISPLAYMODE displayMode = *(D3DDISPLAYMODE*)pAdapterInfo->pDisplayModeList->GetPtr(idm);
        if (displayMode.Format == adapterFormat &&
            displayMode.Width  == width &&
            displayMode.Height == height)
        {
            TCHAR strRefreshRate[50];
            if( displayMode.RefreshRate == 0 )
                lstrcpy( strRefreshRate, TEXT("Default Rate") );
            else
                _sntprintf_s( strRefreshRate, 50, 50, TEXT("%d Hz"), displayMode.RefreshRate );
            strRefreshRate[49] = 0;
            if( !ComboBoxContainsText( IDC_REFRESHRATE_COMBO, strRefreshRate ) )
            {
                ComboBoxAdd( IDC_REFRESHRATE_COMBO, UlongToPtr( displayMode.RefreshRate ), strRefreshRate );
                if (m_d3dSettings.Fullscreen_DisplayMode.RefreshRate == displayMode.RefreshRate)
                    ComboBoxSelect( IDC_REFRESHRATE_COMBO, UlongToPtr( displayMode.RefreshRate ) );
            }
        }
    }
    if (!ComboBoxSomethingSelected( IDC_REFRESHRATE_COMBO ) && 
        ComboBoxCount( IDC_REFRESHRATE_COMBO ) > 0)
    {
        ComboBoxSelectIndex( IDC_REFRESHRATE_COMBO, 0 );
    }
}
开发者ID:xahgo,项目名称:tama,代码行数:51,代码来源:d3dsettings.cpp


示例20: PtrToUlong

// 窗口过程函数
LRESULT CALLBACK ThisApp::WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
    LRESULT result = 0;
    // 创建时 设置指针
    if (message == WM_CREATE) {
        auto pcs = reinterpret_cast<LPCREATESTRUCT>(lParam);
        auto pOurApp = reinterpret_cast<ThisApp*>(pcs->lpCreateParams);
        ::SetWindowLongPtrW(hwnd, GWLP_USERDATA, PtrToUlong(pOurApp));
        result = 1;
    }
    else {
        ThisApp *pOurApp = reinterpret_cast<ThisApp *>(static_cast<LONG_PTR>(
            ::GetWindowLongPtrW(hwnd, GWLP_USERDATA))
            );
        // 处理标记
        bool wasHandled = false;
        if (pOurApp){
            switch (message)
            {
            case WM_LBUTTONDOWN:
                pOurApp->m_ImagaRenderer.PushPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
                __fallthrough;
            case WM_MOUSEMOVE:
                pOurApp->m_ImagaRenderer.Lock();
                if (pOurApp->m_ImagaRenderer.now_point) {
                    pOurApp->m_ImagaRenderer.now_point->x = static_cast<float>(GET_X_LPARAM(lParam));
                    pOurApp->m_ImagaRenderer.now_point->y = static_cast<float>(GET_Y_LPARAM(lParam));
                }
                pOurApp->m_ImagaRenderer.Unlock();
                break;
            case WM_RBUTTONDOWN:
                pOurApp->m_ImagaRenderer.Lock();
                pOurApp->m_ImagaRenderer.now_point = nullptr;
                pOurApp->m_ImagaRenderer.Unlock();
                break;
            case WM_CLOSE:
                // 将收尾操作(如结束全部子线程)放在这里
                pOurApp->m_bExit = TRUE;
                // join
                pOurApp->m_threadRender.join();
                ::DestroyWindow(hwnd);
                result = 1;
                wasHandled = true;
                break;
            case WM_DESTROY:
                ::PostQuitMessage(0);
                result = 1;
                wasHandled = true;
                break;
            }
        }
        // 默认处理标记
        if (!wasHandled) {
            result = ::DefWindowProcW(hwnd, message, wParam, lParam);
        }
    }
    return result;
}
开发者ID:dustpg,项目名称:NoteFL,代码行数:58,代码来源:ThisApp.cpp



注:本文中的PtrToUlong函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PulseEvent函数代码示例发布时间:2022-05-30
下一篇:
C++ Pthread_mutex_unlock函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap