本文整理汇总了C++中LOBYTE函数的典型用法代码示例。如果您正苦于以下问题:C++ LOBYTE函数的具体用法?C++ LOBYTE怎么用?C++ LOBYTE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOBYTE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: address
/******************** Mass Storage interface ********************/
0x09, /* bLength: Interface Descriptor size */
0x04, /* bDescriptorType: */
MSC_INTERFACE, /* bInterfaceNumber: Number of Interface */
0x00, /* bAlternateSetting: Alternate setting */
0x02, /* bNumEndpoints*/
0x08, /* bInterfaceClass: MSC Class */
0x06, /* bInterfaceSubClass : SCSI transparent*/
0x50, /* nInterfaceProtocol */
0x05, /* iInterface: */
/******************** Mass Storage Endpoints ********************/
0x07, /*Endpoint descriptor length = 7*/
0x05, /*Endpoint descriptor type */
MSC_IN_EP, /*Endpoint address (IN, address 1) */
0x02, /*Bulk endpoint type */
LOBYTE(MSC_MAX_PACKET),
HIBYTE(MSC_MAX_PACKET),
0x00, /*Polling interval in milliseconds */
0x07, /*Endpoint descriptor length = 7 */
0x05, /*Endpoint descriptor type */
MSC_OUT_EP, /*Endpoint address (OUT, address 1) */
0x02, /*Bulk endpoint type */
LOBYTE(MSC_MAX_PACKET),
HIBYTE(MSC_MAX_PACKET),
0x00 /*Polling interval in milliseconds*/
} ;
/* Private function prototypes -----------------------------------------------*/
/*********************************************
开发者ID:MbedTinkerer,项目名称:stmbl,代码行数:31,代码来源:usbd_msc_hid_core.c
示例2: CORE_Process
// Plug-in process
void CORE_Process(int iArg)
{
try
{
char version[16];
sprintf(version, "%u.%u", HIBYTE(MY_VERSION), LOBYTE(MY_VERSION));
msg("\n>> WhatAPIs: v: %s, built: %s, By Sirmabus\n", version, __DATE__);
if (!autoIsOk())
{
msg("** Must wait for IDA to finish processing before starting plug-in! **\n*** Aborted ***\n\n");
return;
}
// Show UI
refreshUI();
int uiResult = AskUsingForm_c(mainDialog, version, doHyperlink);
if (!uiResult)
{
msg(" - Canceled -\n");
return;
}
WaitBox::show();
TIMESTAMP startTime = getTimeStamp();
// Build import segment bounds table
{
msg("Import segments:\n");
refreshUI();
SEGLIST segList;
for (int i = 0; i < get_segm_qty(); i++)
{
if (segment_t *s = getnseg(i))
{
if (s->type == SEG_XTRN)
{
char buffer[64] = { "unknown" }; buffer[SIZESTR(buffer)] = 0;
get_true_segm_name(s, buffer, SIZESTR(buffer));
msg(" [%d] \"%s\" "EAFORMAT" - "EAFORMAT"\n", segmentCount, buffer, s->startEA, s->endEA);
BOUNDS b = { s->startEA, s->endEA };
segList.push_back(b);
segmentCount++;
}
}
}
refreshUI();
// Flatten list into an array for speed
if (segmentCount)
{
UINT size = (segmentCount * sizeof(BOUNDS));
if (segmentPtr = (BOUNDS *)_aligned_malloc(size, 16))
{
BOUNDS *b = segmentPtr;
for (SEGLIST::iterator i = segList.begin(); i != segList.end(); i++, b++)
{
b->startEA = i->startEA;
b->endEA = i->endEA;
}
}
else
{
msg("\n*** Allocation failure of %u bytes! ***\n", size);
refreshUI();
}
}
}
if (segmentCount)
{
// Make a list of all import names
if (int moduleCount = get_import_module_qty())
{
for (int i = 0; i < moduleCount; i++)
enum_import_names(i, importNameCallback);
char buffer[32];
msg("Parsed %s module imports.\n", prettyNumberString(moduleCount, buffer));
refreshUI();
}
// Iterate through all functions..
BOOL aborted = FALSE;
UINT functionCount = get_func_qty();
char buffer[32];
msg("Processing %s functions.\n", prettyNumberString(functionCount, buffer));
refreshUI();
for (UINT n = 0; n < functionCount; n++)
{
processFunction(getn_func(n));
if (WaitBox::isUpdateTime())
{
if (WaitBox::updateAndCancelCheck((int)(((float)n / (float)functionCount) * 100.0f)))
{
msg("* Aborted *\n");
break;
}
//.........这里部分代码省略.........
开发者ID:nihilus,项目名称:WhatAPIs,代码行数:101,代码来源:Core.cpp
示例3: init_shofixti
RACE_DESC*
init_shofixti (void)
{
RACE_DESC *RaceDescPtr;
static RACE_DESC new_shofixti_desc;
shofixti_desc.postprocess_func = shofixti_postprocess;
shofixti_desc.init_weapon_func = initialize_standard_missile;
shofixti_desc.cyborg_control.intelligence_func = shofixti_intelligence;
new_shofixti_desc = shofixti_desc;
if (LOBYTE (GLOBAL (CurrentActivity)) == IN_ENCOUNTER
&& !GET_GAME_STATE (SHOFIXTI_RECRUITED))
{
// Tanaka/Katana flies in a damaged ship.
#define NUM_LIMPETS 3
COUNT i;
new_shofixti_desc.ship_data.ship_rsc[0] = OLDSHOF_BIG_MASK_PMAP_ANIM;
new_shofixti_desc.ship_data.ship_rsc[1] = OLDSHOF_MED_MASK_PMAP_ANIM;
new_shofixti_desc.ship_data.ship_rsc[2] = OLDSHOF_SML_MASK_PMAP_ANIM;
new_shofixti_desc.ship_data.special_rsc[0] = NULL_RESOURCE;
new_shofixti_desc.ship_data.special_rsc[1] = NULL_RESOURCE;
new_shofixti_desc.ship_data.special_rsc[2] = NULL_RESOURCE;
new_shofixti_desc.ship_data.captain_control.captain_rsc =
OLDSHOF_CAPTAIN_MASK_PMAP_ANIM;
/* Weapon doesn't work as well */
new_shofixti_desc.characteristics.weapon_wait = 10;
/* Simulate VUX limpets */
for (i = 0; i < NUM_LIMPETS; ++i)
{
if (++new_shofixti_desc.characteristics.turn_wait == 0)
--new_shofixti_desc.characteristics.turn_wait;
if (++new_shofixti_desc.characteristics.thrust_wait == 0)
--new_shofixti_desc.characteristics.thrust_wait;
#define MIN_THRUST_INCREMENT DISPLAY_TO_WORLD (1)
if (new_shofixti_desc.characteristics.thrust_increment <=
MIN_THRUST_INCREMENT)
{
new_shofixti_desc.characteristics.max_thrust =
new_shofixti_desc.characteristics.thrust_increment << 1;
}
else
{
COUNT num_thrusts;
num_thrusts = new_shofixti_desc.characteristics.max_thrust /
new_shofixti_desc.characteristics.thrust_increment;
--new_shofixti_desc.characteristics.thrust_increment;
new_shofixti_desc.characteristics.max_thrust =
new_shofixti_desc.characteristics.thrust_increment *
num_thrusts;
}
}
}
RaceDescPtr = &new_shofixti_desc;
return (RaceDescPtr);
}
开发者ID:seanknox,项目名称:uqm,代码行数:63,代码来源:shofixti.c
示例4: set_tool_item_proc
//.........这里部分代码省略.........
i |= HOTKEYF_WIN;
}
if (ti->virtkey != 0) {
SendDlgItemMessage(hDlg, IDC_HOTKEY_TOOL, HKM_SETHOTKEY,
(WPARAM)MAKEWORD(ti->virtkey, i), 0);
}
SendMessage(hDlg, WM_COMMAND, IDC_CHECK_MENU, 0);
SetWindowLong(hDlg, GWL_USERDATA, lParam);
break;
case WM_CLOSE:
EndDialog(hDlg, FALSE);
break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_CHECK_MENU:
EnableWindow(GetDlgItem(hDlg, IDC_CHECK_COPY_PATE), IsDlgButtonChecked(hDlg, IDC_CHECK_MENU));
EnableWindow(GetDlgItem(hDlg, IDC_HOTKEY_TOOL), IsDlgButtonChecked(hDlg, IDC_CHECK_MENU));
break;
case IDC_BUTTON_FILE_SELECT:
// ファイル選択
SetFocus(GetDlgItem(hDlg, IDC_EDIT_LIB_PATH));
if (file_select(hDlg, TEXT("*.dll\0*.dll\0*.*\0*.*\0\0"), 1, buf) == -1) {
break;
}
SendDlgItemMessage(hDlg, IDC_EDIT_LIB_PATH, WM_SETTEXT, 0, (LPARAM)buf);
SendDlgItemMessage(hDlg, IDC_EDIT_HEADER, WM_SETTEXT, 0, (LPARAM)TEXT(""));
case IDC_BUTTON_FUNC_SELECT:
// ツール選択
*buf = TEXT('\0');
SendDlgItemMessage(hDlg, IDC_EDIT_LIB_PATH, WM_GETTEXT, BUF_SIZE - 1, (LPARAM)buf);
if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DIALOG_SELECT_FUNC), hDlg, select_tool_proc, (LPARAM)buf) == TRUE) {
SendMessage(hDlg, WM_COMMAND, IDC_CHECK_MENU, 0);
}
break;
case IDOK:
*buf = TEXT('\0');
SendDlgItemMessage(hDlg, IDC_EDIT_TITLE, WM_GETTEXT, BUF_SIZE - 1, (LPARAM)buf);
if (*buf == TEXT('\0')) {
MessageBox(hDlg, message_get_res(IDS_TOOL_ERR_TITLE), WINDOW_TITLE, MB_ICONEXCLAMATION);
SetFocus(GetDlgItem(hDlg, IDC_EDIT_TITLE));
break;
}
if ((ti = (TOOL_INFO *)GetWindowLong(hDlg, GWL_USERDATA)) == NULL) {
ti = mem_calloc(sizeof(TOOL_INFO));
}
if (ti != NULL) {
// 設定取得
alloc_get_text(GetDlgItem(hDlg, IDC_EDIT_TITLE), &ti->title);
alloc_get_text(GetDlgItem(hDlg, IDC_EDIT_LIB_PATH), &ti->lib_file_path);
alloc_get_text(GetDlgItem(hDlg, IDC_EDIT_HEADER), &ti->func_name);
alloc_get_text(GetDlgItem(hDlg, IDC_EDIT_CMD_LINE), &ti->cmd_line);
ti->call_type = 0;
ti->call_type |= (IsDlgButtonChecked(hDlg, IDC_CHECK_MENU) * CALLTYPE_MENU);
ti->call_type |= (IsDlgButtonChecked(hDlg, IDC_CHECK_VIEWER) * CALLTYPE_VIEWER);
ti->call_type |= (IsDlgButtonChecked(hDlg, IDC_CHECK_VIEWER_OPEN) * CALLTYPE_VIEWER_OPEN);
ti->call_type |= (IsDlgButtonChecked(hDlg, IDC_CHECK_VIEWER_CLOSE) * CALLTYPE_VIEWER_CLOSE);
ti->call_type |= (IsDlgButtonChecked(hDlg, IDC_CHECK_HISTORY) * CALLTYPE_ADD_HISTORY);
ti->call_type |= (IsDlgButtonChecked(hDlg, IDC_CHECK_CLIPBOARD) * CALLTYPE_ITEM_TO_CLIPBOARD);
ti->call_type |= (IsDlgButtonChecked(hDlg, IDC_CHECK_START) * CALLTYPE_START);
ti->call_type |= (IsDlgButtonChecked(hDlg, IDC_CHECK_END) * CALLTYPE_END);
ti->copy_paste = IsDlgButtonChecked(hDlg, IDC_CHECK_COPY_PATE);
ti->old = IsDlgButtonChecked(hDlg, IDC_CHECK_OLD);
i = SendDlgItemMessage(hDlg, IDC_HOTKEY_TOOL, HKM_GETHOTKEY, 0, 0);
ti->virtkey = LOBYTE(i);
i = HIBYTE(i);
ti->modifiers = ((i & HOTKEYF_SHIFT) ? MOD_SHIFT : 0) |
((i & HOTKEYF_CONTROL) ? MOD_CONTROL : 0) |
((i & HOTKEYF_ALT) ? MOD_ALT : 0) |
((i & HOTKEYF_WIN) ? MOD_WIN : 0);
}
if (GetWindowLong(hDlg, GWL_USERDATA) == 0) {
// 新規
HWND pWnd = PropSheet_GetCurrentPageHwnd(GetParent(hDlg));
listview_set_tool(GetDlgItem(pWnd, IDC_LIST_TOOL), ti, FALSE);
}
EndDialog(hDlg, TRUE);
break;
case IDCANCEL:
EndDialog(hDlg, FALSE);
break;
}
break;
default:
return FALSE;
}
return TRUE;
}
开发者ID:tobynet,项目名称:clcl,代码行数:101,代码来源:SetTool.c
示例5: getEepeomParameter
//-------------------------------------------------------------------------------------------------
// Public Functions
//-------------------------------------------------------------------------------------------------
static ST_EEPROM_PARA getEepeomParameter(ST_EEPROM_ID EepromType,MS_U16 offset)
{
ST_EEPROM_PARA stEtype;
u16 u16Tmp = 0;
switch(EepromType.type)
{
case EEPROM_24C01:
case EEPROM_24C02:
stEtype.u16SlaveIDAddr=EepromType.u16DeviceAddr;
stEtype.u8AddrCnt=1;
stEtype.pu8Offset[0]=LOBYTE(offset);
stEtype.u8PageSize=8;
break;
case EEPROM_24C04:
u16Tmp=((HIBYTE(offset)&0x1)<<1);
stEtype.u16SlaveIDAddr=(EepromType.u16DeviceAddr|u16Tmp);
stEtype.u8AddrCnt=1;
stEtype.pu8Offset[0]=LOBYTE(offset);
stEtype.u8PageSize=16;
break;
case EEPROM_24C08:
u16Tmp=((HIBYTE(offset)&0x3)<<1);
stEtype.u16SlaveIDAddr=(EepromType.u16DeviceAddr|u16Tmp);
stEtype.u8AddrCnt=1;
stEtype.pu8Offset[0]=LOBYTE(offset);
stEtype.u8PageSize=16;
break;
case EEPROM_24C16:
u16Tmp=((HIBYTE(offset)&0x7)<<1);
stEtype.u16SlaveIDAddr=(EepromType.u16DeviceAddr|u16Tmp);
stEtype.u8AddrCnt=1;
stEtype.pu8Offset[0]=LOBYTE(offset);
stEtype.u8PageSize=16;
break;
case EEPROM_24C32:
case EEPROM_24C64:
stEtype.u8PageSize=32;
stEtype.u16SlaveIDAddr=EepromType.u16DeviceAddr;
stEtype.u8AddrCnt=2;
stEtype.pu8Offset[0]=HIBYTE(offset);
stEtype.pu8Offset[1]=LOBYTE(offset);
break;
case EEPROM_24C128:
case EEPROM_24C256:
stEtype.u8PageSize=64;
stEtype.u16SlaveIDAddr=EepromType.u16DeviceAddr;
stEtype.u8AddrCnt=2;
stEtype.pu8Offset[0]=HIBYTE(offset);
stEtype.pu8Offset[1]=LOBYTE(offset);
break;
case EEPROM_24C512:
stEtype.u8PageSize=128;
stEtype.u16SlaveIDAddr=EepromType.u16DeviceAddr;
stEtype.u8AddrCnt=2;
stEtype.pu8Offset[0]=HIBYTE(offset);
stEtype.pu8Offset[1]=LOBYTE(offset);
case EEPROM_24C1024:
stEtype.u8PageSize=256;
stEtype.u16SlaveIDAddr=EepromType.u16DeviceAddr;
stEtype.u8AddrCnt=2;
stEtype.pu8Offset[0]=HIBYTE(offset);
stEtype.pu8Offset[1]=LOBYTE(offset);
break;
default:
UBOOT_ERROR("Wrong Eeprom Type!!\n");
break;
}
return stEtype;
}
开发者ID:Scorpio92,项目名称:mstar6a918,代码行数:73,代码来源:MsEeprom.c
示例6: ImmEscapeW
LRESULT WINAPI ImmEscapeW(
HKL hKL,
HIMC hImc,
UINT uSubFunc,
LPVOID lpData)
{
PIMEDPI pImeDpi;
LRESULT lRet = 0;
pImeDpi = FindOrLoadImeDpi(hKL);
if (pImeDpi == NULL) {
RIPMSG0(RIP_WARNING, "ImmEscapeW: no pImeDpi entry.");
return lRet;
}
if ((pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE) || lpData == NULL) {
/*
* Doesn't need W/A conversion. Calls directly to IME to
* bring up the configuration dialogbox.
*/
lRet = (*pImeDpi->pfn.ImeEscape)(hImc, uSubFunc, lpData);
ImmUnlockImeDpi(pImeDpi);
return lRet;
}
/*
* Unicode caller, ANSI IME. Needs W/A conversion depending on
* uSubFunc.
*/
switch (uSubFunc) {
case IME_ESC_GET_EUDC_DICTIONARY:
case IME_ESC_IME_NAME:
{
CHAR szData[IME_T_EUDC_DIC_SIZE];
INT i;
lRet = ImmEscapeA(hKL, hImc, uSubFunc, (LPVOID)szData);
if (lRet != 0) {
try {
i = MultiByteToWideChar(CP_ACP,
(DWORD)MB_PRECOMPOSED,
(LPSTR)szData, // src
(INT)strlen(szData),
(LPWSTR)lpData, // dest
(INT)IME_T_EUDC_DIC_SIZE);
((LPWSTR)lpData)[i] = L'\0';
}
except (EXCEPTION_EXECUTE_HANDLER) {
lRet = 0;
}
}
break;
}
case IME_ESC_SET_EUDC_DICTIONARY:
case IME_ESC_HANJA_MODE:
{
CHAR szData[IME_T_EUDC_DIC_SIZE];
BOOL bUDC;
INT i;
i = WideCharToMultiByte( CP_ACP,
(DWORD)0,
(LPWSTR)lpData, // src
(INT)wcslen(lpData),
(LPSTR)szData, // dest
(INT)sizeof(szData),
(LPSTR)NULL,
(LPBOOL)&bUDC);
szData[i] = '\0';
lRet = ImmEscapeA(hKL, hImc, uSubFunc, (LPVOID)szData);
break;
}
case IME_ESC_SEQUENCE_TO_INTERNAL:
{
CHAR szData[4];
WCHAR wszData[4];
INT i = 0;
lRet = ImmEscapeA(hKL, hImc, uSubFunc, lpData);
if (HIBYTE(LOWORD(lRet)))
szData[i++] = HIBYTE(LOWORD(lRet));
if (LOBYTE(LOWORD(lRet)))
szData[i++] = LOBYTE(LOWORD(lRet));
i = MultiByteToWideChar(CP_ACP,
(DWORD)MB_PRECOMPOSED,
(LPSTR)szData, // src
i,
(LPWSTR)wszData, // dest
(INT)sizeof(wszData)/sizeof(WCHAR));
//.........这里部分代码省略.........
开发者ID:Gaikokujin,项目名称:WinNT4,代码行数:101,代码来源:immime.c
示例7: PackCommRqtEx
static int
PackCommRqtEx(unsigned char* pAppBuf, int nAppBufLen, PBYTE pSA, PBYTE pDA, BOOL bNeedRsp, unsigned char nSeq, unsigned char* pFrm)
{
int nFrmLen = 0;
int nLenPos = OFFSET_COM_LY_PACKAGE_LEN;
// unsigned int nSeq = GetNextRqtSeq();
unsigned short usChk = 0;
int i = 0;
// STX
*(pFrm + nFrmLen + 1) = BACP_COM_LY_STX_B0;
*(pFrm + nFrmLen + 0) = BACP_COM_LY_STX_B1;
nFrmLen += LEN_COM_STX;
// VER
*(pFrm + nFrmLen) = CURRENT_COM_NET_LAY_VER;
nFrmLen += LEN_COM_VER;
// LEN
nFrmLen += LEN_COM_LEN;
// SEQ
*(pFrm + nFrmLen + 0) = nSeq;
nFrmLen += LEN_COM_SEQ;
// OPT
if (bNeedRsp)
{
*(pFrm + nFrmLen) = COM_LY_OPT_REQ_ON ;
}
else
{
*(pFrm + nFrmLen) = COM_LY_OPT_REQ_OFF ;
}
nFrmLen += LEN_COM_OPT;
memcpy(pFrm + nFrmLen, pDA, 3);
nFrmLen += LEN_COM_DA;
memcpy(pFrm + nFrmLen, pSA, 3);
nFrmLen += LEN_COM_SA;
// APP
memcpy((pFrm + nFrmLen), pAppBuf, nAppBufLen);
nFrmLen += nAppBufLen;
// check num
nFrmLen += 2;
// ETX
*(pFrm + nFrmLen + 1) = BACP_COM_LY_ETX_B0;
*(pFrm + nFrmLen + 0) = BACP_COM_LY_ETX_B1;
nFrmLen += LEN_COM_ETX;
// Fill LEN
*(pFrm + nLenPos + 1) = LOBYTE(nFrmLen);
*(pFrm + nLenPos + 0) = HIBYTE(nFrmLen);
usChk = 0;
for (i = LEN_COM_STX; i < nFrmLen - 4; i++)
{
usChk += *(pFrm + i);
}
*(pFrm + nFrmLen - 3) = LOBYTE(usChk);
*(pFrm + nFrmLen - 4) = HIBYTE(usChk);
return nFrmLen;
}
开发者ID:SkyChen2012,项目名称:GMApp,代码行数:72,代码来源:LCAPro_mox_V2.c
示例8: modData
/**************************************************************************
* modData [internal]
*/
static DWORD modData(WORD wDevID, DWORD dwParam)
{
BYTE evt = LOBYTE(LOWORD(dwParam));
BYTE d1 = HIBYTE(LOWORD(dwParam));
BYTE d2 = LOBYTE(HIWORD(dwParam));
TRACE("(%04X, %08lX);\n", wDevID, dwParam);
if (wDevID >= MODM_NumDevs) return MMSYSERR_BADDEVICEID;
if (!MidiOutDev[wDevID].bEnabled) return MIDIERR_NODEVICE;
if (midiSeq == NULL) {
WARN("can't play !\n");
return MIDIERR_NODEVICE;
}
switch (MidiOutDev[wDevID].caps.wTechnology) {
case MOD_SYNTH:
case MOD_MIDIPORT:
{
int handled = 1; /* Assume event is handled */
snd_seq_event_t event;
snd_seq_ev_clear(&event);
snd_seq_ev_set_direct(&event);
snd_seq_ev_set_source(&event, port_out);
snd_seq_ev_set_dest(&event, MidiOutDev[wDevID].addr.client, MidiOutDev[wDevID].addr.port);
switch (evt & 0xF0) {
case MIDI_CMD_NOTE_OFF:
snd_seq_ev_set_noteoff(&event, evt&0x0F, d1, d2);
break;
case MIDI_CMD_NOTE_ON:
snd_seq_ev_set_noteon(&event, evt&0x0F, d1, d2);
break;
case MIDI_CMD_NOTE_PRESSURE:
snd_seq_ev_set_keypress(&event, evt&0x0F, d1, d2);
break;
case MIDI_CMD_CONTROL:
snd_seq_ev_set_controller(&event, evt&0x0F, d1, d2);
break;
case MIDI_CMD_BENDER:
snd_seq_ev_set_pitchbend(&event, evt&0x0F, ((WORD)d2 << 7 | (WORD)d1) - 0x2000);
break;
case MIDI_CMD_PGM_CHANGE:
snd_seq_ev_set_pgmchange(&event, evt&0x0F, d1);
break;
case MIDI_CMD_CHANNEL_PRESSURE:
snd_seq_ev_set_chanpress(&event, evt&0x0F, d1);
break;
case MIDI_CMD_COMMON_SYSEX:
switch (evt & 0x0F) {
case 0x00: /* System Exclusive, don't do it on modData,
* should require modLongData*/
case 0x01: /* Undefined */
case 0x04: /* Undefined. */
case 0x05: /* Undefined. */
case 0x07: /* End of Exclusive. */
case 0x09: /* Undefined. */
case 0x0D: /* Undefined. */
handled = 0;
break;
case 0x06: /* Tune Request */
case 0x08: /* Timing Clock. */
case 0x0A: /* Start. */
case 0x0B: /* Continue */
case 0x0C: /* Stop */
case 0x0E: /* Active Sensing. */
/* FIXME: Is this function suitable for these purposes
(and also Song Select and Song Position Pointer) */
snd_seq_ev_set_sysex(&event, 1, &evt);
break;
case 0x0F: /* Reset */
/* snd_seq_ev_set_sysex(&event, 1, &evt);
this other way may be better */
{
BYTE reset_sysex_seq[] = {MIDI_CMD_COMMON_SYSEX, 0x7e, 0x7f, 0x09, 0x01, 0xf7};
snd_seq_ev_set_sysex(&event, sizeof(reset_sysex_seq), reset_sysex_seq);
}
break;
case 0x03: /* Song Select. */
{
BYTE buf[2];
buf[0] = evt;
buf[1] = d1;
snd_seq_ev_set_sysex(&event, sizeof(buf), buf);
}
break;
case 0x02: /* Song Position Pointer. */
{
BYTE buf[3];
buf[0] = evt;
buf[1] = d1;
buf[2] = d2;
snd_seq_ev_set_sysex(&event, sizeof(buf), buf);
}
break;
}
break;
//.........这里部分代码省略.........
开发者ID:howard5888,项目名称:wineT,代码行数:101,代码来源:midi.c
示例9: main
/**
* main
*
* executable entry point
*/
INT __cdecl main( INT argc, CHAR **argv )
{
/* local variables */
int err;
int i,j;
WORD wVersionRequested;
WSADATA wsaData;
DWORD dwSocketError;
SOCKET sock = INVALID_SOCKET;
/* PAL initialization */
if( (PAL_Initialize(argc, argv)) != 0 )
{
return( FAIL );
}
/* try to cleanup the winsock library -- should fail */
/* since we haven't initialized it yet */
err = WSACleanup();
if( err == 0 )
{
Fail( "WSACleanup call succeeded before call to WSAStartup\n" );
}
/* check the socket-specific error code */
dwSocketError = GetLastError();
if( dwSocketError != WSANOTINITIALISED )
{
Fail( "WSACleanup call does not return WSANOTINITIALISED "
"before successful call to WSAStartup\n" );
}
/* initialize winsock version 2.2 */
wVersionRequested = MAKEWORD( 2, 2 );
for(i=0;i<5;i++)
{
err = WSAStartup( wVersionRequested, &wsaData );
if( err != 0 )
{
for(j=0;j<i;j++)
{
err = WSACleanup();
if( err != 0 )
{
/* check the socket-specific error code */
dwSocketError = GetLastError();
Trace( "WSACleanup call fails with error code %d\n",
dwSocketError );
}
}
Fail( "Unexpected WSAStartup call failed with error code %d\n",
err );
}
/* Confirm that the WinSock DLL supports the specified version. */
if( LOBYTE( wsaData.wVersion ) != 2 ||
HIBYTE( wsaData.wVersion ) != 2 )
{
/* Tell the user that we could not find a usable winsock DLL. */
Trace( "Requested winsock version unsupported, "
"returned version %d.%d\n",
LOBYTE( wsaData.wVersion ),
HIBYTE( wsaData.wVersion ) );
for(j=0;j<=i;j++)
{
err = WSACleanup();
if( err != 0 )
{
/* check the socket-specific error code */
dwSocketError = GetLastError();
Trace( "WSACleanup call fails with error code %d\n",
dwSocketError );
}
}
return( FAIL );
}
}
for(i=0;i<4;i++)
{
/* try to cleanup the winsock library -- should succeed now */
err = WSACleanup();
if( err != 0 )
{
/* check the socket-specific error code */
dwSocketError = GetLastError();
Fail( "WSACleanup call fails with error code %d\n",
dwSocketError );
}
//.........这里部分代码省略.........
开发者ID:ArildF,项目名称:masters,代码行数:101,代码来源:test1.c
示例10: USBD_StdEPReq
/**
* @brief USBD_StdEPReq
* Handle standard usb endpoint requests
* @param pdev: USB OTG device instance
* @param req: usb request
* @retval status
*/
USBD_Status USBD_StdEPReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req)
{
uint8_t ep_addr;
USBD_Status ret = USBD_OK;
ep_addr = LOBYTE(req->wIndex);
switch (req->bRequest)
{
case USB_REQ_SET_FEATURE :
switch (pdev->dev.device_status)
{
case USB_OTG_ADDRESSED:
if ((ep_addr != 0x00) && (ep_addr != 0x80))
{
DCD_EP_Stall(pdev , ep_addr);
}
break;
case USB_OTG_CONFIGURED:
if (req->wValue == USB_FEATURE_EP_HALT)
{
if ((ep_addr != 0x00) && (ep_addr != 0x80))
{
DCD_EP_Stall(pdev , ep_addr);
}
}
pdev->dev.class_cb->Setup (pdev, req);
USBD_CtlSendStatus(pdev);
break;
default:
USBD_CtlError(pdev , req);
break;
}
break;
case USB_REQ_CLEAR_FEATURE :
switch (pdev->dev.device_status)
{
case USB_OTG_ADDRESSED:
if ((ep_addr != 0x00) && (ep_addr != 0x80))
{
DCD_EP_Stall(pdev , ep_addr);
}
break;
case USB_OTG_CONFIGURED:
if (req->wValue == USB_FEATURE_EP_HALT)
{
if ((ep_addr != 0x00) && (ep_addr != 0x80))
{
DCD_EP_ClrStall(pdev , ep_addr);
pdev->dev.class_cb->Setup (pdev, req);
}
USBD_CtlSendStatus(pdev);
}
break;
default:
USBD_CtlError(pdev , req);
break;
}
break;
case USB_REQ_GET_STATUS:
switch (pdev->dev.device_status)
{
case USB_OTG_ADDRESSED:
if ((ep_addr != 0x00) && (ep_addr != 0x80))
{
DCD_EP_Stall(pdev , ep_addr);
}
break;
case USB_OTG_CONFIGURED:
if ((ep_addr & 0x80)== 0x80)
{
if(pdev->dev.in_ep[ep_addr & 0x7F].is_stall)
{
USBD_ep_status = 0x0001;
}
else
{
USBD_ep_status = 0x0000;
//.........这里部分代码省略.........
开发者ID:fl04t,项目名称:codec2,代码行数:101,代码来源:usbd_req.c
示例11: TestSuite_PrintJsonHeader
static void
TestSuite_PrintJsonHeader (TestSuite *suite, /* IN */
FILE *stream) /* IN */
{
#ifdef _WIN32
# define INFO_BUFFER_SIZE 32767
SYSTEM_INFO si;
DWORD version = 0;
DWORD major_version = 0;
DWORD minor_version = 0;
DWORD build = 0;
GetSystemInfo(&si);
version = GetVersion();
major_version = (DWORD)(LOBYTE(LOWORD(version)));
minor_version = (DWORD)(HIBYTE(LOWORD(version)));
if (version < 0x80000000) {
build = (DWORD)(HIWORD(version));
}
fprintf (stream,
"{\n"
" \"host\": {\n"
" \"sysname\": \"Windows\",\n"
" \"release\": \"%ld.%ld (%ld)\",\n"
" \"machine\": \"%ld\",\n"
" \"memory\": {\n"
" \"pagesize\": %ld,\n"
" \"npages\": %d\n"
" }\n"
" },\n"
" \"options\": {\n"
" \"parallel\": \"%s\",\n"
" \"fork\": \"%s\"\n"
" },\n"
" \"tests\": [\n",
major_version, minor_version, build,
si.dwProcessorType,
si.dwPageSize,
0,
(suite->flags & TEST_NOTHREADS) ? "false" : "true",
(suite->flags & TEST_NOFORK) ? "false" : "true");
#else
struct utsname u;
uint64_t pagesize;
uint64_t npages = 0;
ASSERT (suite);
if (uname (&u) == -1) {
perror ("uname()");
return;
}
pagesize = sysconf (_SC_PAGE_SIZE);
# if defined(_SC_PHYS_PAGES)
npages = sysconf (_SC_PHYS_PAGES);
# endif
fprintf (stream,
"{\n"
" \"host\": {\n"
" \"sysname\": \"%s\",\n"
" \"release\": \"%s\",\n"
" \"machine\": \"%s\",\n"
" \"memory\": {\n"
" \"pagesize\": %"PRIu64",\n"
" \"npages\": %"PRIu64"\n"
" }\n"
" },\n"
" \"options\": {\n"
" \"parallel\": \"%s\",\n"
" \"fork\": \"%s\"\n"
" },\n"
" \"tests\": [\n",
u.sysname,
u.release,
u.machine,
pagesize,
npages,
(suite->flags & TEST_NOTHREADS) ? "false" : "true",
(suite->flags & TEST_NOFORK) ? "false" : "true");
#endif
fflush (stream);
}
开发者ID:duzhanyuan,项目名称:SequoiaDB,代码行数:90,代码来源:TestSuite.c
示例12: keyDownCallback
static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
if (argumentCount < 1)
return JSValueMakeUndefined(context);
static const JSStringRef lengthProperty = JSStringCreateWithUTF8CString("length");
COMPtr<IWebFramePrivate> framePrivate;
if (SUCCEEDED(frame->QueryInterface(&framePrivate)))
framePrivate->layout();
JSStringRef character = JSValueToStringCopy(context, arguments[0], exception);
ASSERT(!*exception);
int virtualKeyCode;
int charCode = 0;
int keyData = 1;
bool needsShiftKeyModifier = false;
if (JSStringIsEqualToUTF8CString(character, "leftArrow")) {
virtualKeyCode = VK_LEFT;
keyData += KF_EXTENDED << 16; // In this case, extended means "not keypad".
} else if (JSStringIsEqualToUTF8CString(character, "rightArrow")) {
virtualKeyCode = VK_RIGHT;
keyData += KF_EXTENDED << 16;
} else if (JSStringIsEqualToUTF8CString(character, "upArrow")) {
virtualKeyCode = VK_UP;
keyData += KF_EXTENDED << 16;
} else if (JSStringIsEqualToUTF8CString(character, "downArrow")) {
virtualKeyCode = VK_DOWN;
keyData += KF_EXTENDED << 16;
} else if (JSStringIsEqualToUTF8CString(character, "pageUp"))
virtualKeyCode = VK_PRIOR;
else if (JSStringIsEqualToUTF8CString(character, "pageDown"))
virtualKeyCode = VK_NEXT;
else if (JSStringIsEqualToUTF8CString(character, "home"))
virtualKeyCode = VK_HOME;
else if (JSStringIsEqualToUTF8CString(character, "end"))
virtualKeyCode = VK_END;
else if (JSStringIsEqualToUTF8CString(character, "insert"))
virtualKeyCode = VK_INSERT;
else if (JSStringIsEqualToUTF8CString(character, "delete"))
virtualKeyCode = VK_DELETE;
else if (JSStringIsEqualToUTF8CString(character, "printScreen"))
virtualKeyCode = VK_SNAPSHOT;
else if (JSStringIsEqualToUTF8CString(character, "menu"))
virtualKeyCode = VK_APPS;
else if (JSStringIsEqualToUTF8CString(character, "leftControl"))
virtualKeyCode = VK_LCONTROL;
else if (JSStringIsEqualToUTF8CString(character, "leftShift"))
virtualKeyCode = VK_LSHIFT;
else if (JSStringIsEqualToUTF8CString(character, "leftAlt"))
virtualKeyCode = VK_LMENU;
else if (JSStringIsEqualToUTF8CString(character, "rightControl"))
virtualKeyCode = VK_RCONTROL;
else if (JSStringIsEqualToUTF8CString(character, "rightShift"))
virtualKeyCode = VK_RSHIFT;
else if (JSStringIsEqualToUTF8CString(character, "rightAlt"))
virtualKeyCode = VK_RMENU;
else {
charCode = JSStringGetCharactersPtr(character)[0];
virtualKeyCode = LOBYTE(VkKeyScan(charCode));
if (WTF::isASCIIUpper(charCode))
needsShiftKeyModifier = true;
}
JSStringRelease(character);
BYTE keyState[256];
if (argumentCount > 1 || needsShiftKeyModifier) {
::GetKeyboardState(keyState);
BYTE newKeyState[256];
memcpy(newKeyState, keyState, sizeof(keyState));
if (needsShiftKeyModifier)
newKeyState[VK_SHIFT] = 0x80;
if (argumentCount > 1) {
JSObjectRef modifiersArray = JSValueToObject(context, arguments[1], 0);
if (modifiersArray) {
int modifiersCount = JSValueToNumber(context, JSObjectGetProperty(context, modifiersArray, lengthProperty, 0), 0);
for (int i = 0; i < modifiersCount; ++i) {
JSValueRef value = JSObjectGetPropertyAtIndex(context, modifiersArray, i, 0);
JSStringRef string = JSValueToStringCopy(context, value, 0);
if (JSStringIsEqualToUTF8CString(string, "ctrlKey") || JSStringIsEqualToUTF8CString(string, "addSelectionKey"))
newKeyState[VK_CONTROL] = 0x80;
else if (JSStringIsEqualToUTF8CString(string, "shiftKey") || JSStringIsEqualToUTF8CString(string, "rangeSelectionKey"))
newKeyState[VK_SHIFT] = 0x80;
else if (JSStringIsEqualToUTF8CString(string, "altKey"))
newKeyState[VK_MENU] = 0x80;
JSStringRelease(string);
}
}
}
::SetKeyboardState(newKeyState);
}
MSG msg = makeMsg(webViewWindow, (::GetKeyState(VK_MENU) & 0x8000) ? WM_SYSKEYDOWN : WM_KEYDOWN, virtualKeyCode, keyData);
if (virtualKeyCode != 255)
dispatchMessage(&msg);
//.........这里部分代码省略.........
开发者ID:Spencerx,项目名称:webkit,代码行数:101,代码来源:EventSender.cpp
示例13: main
int __cdecl main(int argc, char *argv[])
{
WORD VersionRequested = MAKEWORD(2,2);
WSADATA WsaData;
int err;
int socketID;
struct sockaddr_in mySockaddr;
/*set the backlog number*/
const int BacklogNumber = 10;
/*Initialize the PAL environment*/
err = PAL_Initialize(argc, argv);
if(0 != err)
{
return FAIL;
}
/*initialize to use winsock2.dll*/
err = WSAStartup(VersionRequested,&WsaData);
if(err != 0)
{
Fail("\nFailed to find a usable WinSock DLL!\n");
}
/*Confirm that the WinSock DLL supports 2.2.*/
if(LOBYTE( WsaData.wVersion ) != 2 ||
HIBYTE( WsaData.wVersion ) != 2)
{
Trace("\nFailed to find a usable WinSock DLL!\n");
err = WSACleanup();
if(SOCKET_ERROR == err)
{
Trace("\nFailed to call WSACleanup API!\n");
}
Fail("");
}
/*create a datagram socket in AF_INET domain*/
socketID = socket(AF_INET,SOCK_DGRAM,0);
if(INVALID_SOCKET == socketID)
{
Trace("\nFailed to call socket API to create a stream socket!\n");
err = WSACleanup();
if(SOCKET_ERROR == err)
{
Trace("\nFailed to call WSACleanup API!\n");
}
Fail("");
}
/*prepare the sockaddr structure*/
mySockaddr.sin_family = AF_INET;
mySockaddr.sin_port = 0;
mySockaddr.sin_addr.S_un.S_addr = INADDR_ANY;
memset( &(mySockaddr.sin_zero), 0, 8);
/*bind local address to a socket*/
err = bind(socketID,(struct sockaddr *)&mySockaddr,sizeof(struct sockaddr));
if(SOCKET_ERROR == err)
{
Trace("\nFailed to call bind API to bind a socket with "
"local address!\n");
err = closesocket(socketID);
if(SOCKET_ERROR == err)
{
Trace("\nFailed to call closesocket API!\n");
}
err = WSACleanup();
if(SOCKET_ERROR == err)
{
Trace("\nFailed to call WSACleanup API!\n");
}
Fail("");
}
/*to setup the backlog number for a datagram socket*/
err = listen(socketID,BacklogNumber);
if(WSAEOPNOTSUPP != GetLastError() || SOCKET_ERROR != err)
{
Trace("\nFailed to call listen API for a negative test, "
"setup backlog number for a datagram socket!\n");
err = closesocket(socketID);
if(SOCKET_ERROR == err)
{
Trace("\nFailed to call closesocket API!\n");
}
err = WSACleanup();
if(SOCKET_ERROR == err)
{
Trace("\nFailed to call WSACleanup API!\n");
}
Fail("");
}
err = closesocket(socketID);
if(SOCKET_ERROR == err)
{
Trace("\nFailed to call closesocket API!\n");
err = WSACleanup();
//.........这里部分代码省略.........
开发者ID:smartmaster,项目名称:sscli,代码行数:101,代码来源:listen_neg.c
示例14: m_bWinXPOrLater
CCherryNotificationDialog::CCherryNotificationDialog()
:
m_bWinXPOrLater(IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 0))
{
Initialize();
}
开发者ID:ogoons,项目名称:CherryLib,代码行数:6,代码来源:CherryNotificationDialog.cpp
示例15: listen_tcp
// Listen to incoming TCP requests. Supply the port you want the server to listen on
int listen_tcp(int host_port) {
// adapted from: http://www.tidytutorials.com/2009/12/c-winsock-example-using-client-server.html
int err = 0;
// Initialize socket support WINDOWS ONLY!
unsigned short wVersionRequested;
WSADATA wsaData;
wVersionRequested = MAKEWORD(2, 2);
err = WSAStartup(wVersionRequested, &wsaData);
if (err != 0 || (LOBYTE(wsaData.wVersion) != 2 ||
HIBYTE(wsaData.wVersion) != 2)) {
fprintf(stderr, "Could not find useable sock dll %d\n", WSAGetLastError());
goto FINISH;
}
// Initialize sockets and set any options
int hsock;
int* p_int ;
hsock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (hsock == -1) {
printf("Error initializing socket %d\n", WSAGetLastError());
goto FINISH;
}
p_int = (int*)malloc(sizeof(int));
*p_int = 1;
if ((setsockopt(hsock, SOL_SOCKET, SO_REUSEADDR, (char*)p_int, sizeof(int)) == -1)||
(setsockopt(hsock, SOL_SOCKET, SO_KEEPALIVE, (char*)p_int, sizeof(int)) == -1)) {
printf("Error setting options %d\n", WSAGetLastError());
free(p_int);
goto FINISH;
}
free(p_int);
// Bind and listen
struct sockaddr_in my_addr;
my_addr.sin_family = AF_INET ;
my_addr.sin_port = htons(host_port);
memset(&(my_addr.sin_zero), 0, 8);
my_addr.sin_addr.s_addr = INADDR_ANY ;
if (bind(hsock, (struct sockaddr*)&my_addr, sizeof(my_addr)) != 0) {
fprintf(stderr,"Error binding to socket, make sure nothing else is listening on port %d\n", WSAGetLastError());
goto FINISH;
}
if (listen(hsock, 10) != 0) {
fprintf(stderr, "Error listening %d\n", WSAGetLastError());
goto FINISH;
}
// wait for connections
int* csock;
sockaddr_in sadr;
int addr_size = sizeof(SOCKADDR);
while (true) {
printf("Listening for a TCP connection on port %d\n", host_port);
csock = (int*)malloc(sizeof(int));
if ((*csock = accept(hsock, (SOCKADDR*)&sadr, &addr_size)) != INVALID_SOCKET) {
printf("Connection attempt from %s\n", inet_ntoa(sadr.sin_addr));
err = HandleTCPConnection(csock);
fprintf(stderr, "Result: %d\n", err);
}
else{
fprintf(stderr, "Error accepting %d\n",WSAGetLastError());
}
}
FINISH:
return err;
}
开发者ID:leomeyer,项目名称:OPDI,代码行数:80,代码来源:WinOPDI.cpp
示例16: main
/* =========================== */
int main(int argc,char *argv[])
{
unsigned short port;
int result;
int err;
SOCKET masterSock;
SOCKET clientSock;
em_workspace_t *wrk;
struct sockaddr_in servAddr;
int i;
WORD wVersionRequested;
WSADATA wsaData;
int clientAddrLen;
struct sockaddr clientAddr;
fprintf(stdout,"Embedded Web Server - Windows 95 : %s\n",__TIMESTAMP__);
fprintf(stdout,"Copyright (c) 1995-1996 David M. Howard\n");
port = w95t_server_port;
/* initialize printf */
printf_init();
/* =============================================== */
/* initialize winsock library */
/* =============================================== */
wVersionRequested = MAKEWORD(1, 1);
err = WSAStartup(wVersionRequested, &wsaData);
if (err != 0) {
fprintf(stderr,"Can't initialize winsock lib\n");
exit(1);
}
/* Confirm that the Windows Sockets DLL supports 1.1.*/
/* Note that if the DLL supports versions greater */
/* than 1.1
|
请发表评论