Exec_stat MCPurchaseGet(MCPurchase *p_purchase, MCPurchaseProperty p_property, MCExecPoint &ep) { //MCLog("MCPurchaseGet(%p, %d, ...)", p_purchase, p_property); MCAndroidPurchase *t_android_data = (MCAndroidPurchase*)p_purchase->platform_data; switch (p_property) { case kMCPurchasePropertyProductIdentifier: ep.copysvalue(t_android_data->product_id); return ES_NORMAL; case kMCPurchasePropertyDeveloperPayload: if (t_android_data->developer_payload == nil) ep.clear(); else ep.copysvalue(t_android_data->developer_payload); return ES_NORMAL; case kMCPurchasePropertySignedData: if (t_android_data->signed_data == nil) ep.clear(); else ep.copysvalue(t_android_data->signed_data); return ES_NORMAL; case kMCPurchasePropertySignature: if (t_android_data->signature == nil) ep.clear(); else ep.copysvalue(t_android_data->signature); return ES_NORMAL; case kMCPurchasePropertyTransactionIdentifier: if (t_android_data->order_id == nil) ep.clear(); else ep.copysvalue(t_android_data->order_id); return ES_NORMAL; case kMCPurchasePropertyPurchaseDate: ep.setint64(t_android_data->purchase_time); return ES_NORMAL; default: break; } return ES_NOT_HANDLED; }
void MCScreenDC::getkeysdown(MCExecPoint &ep) { BYTE keystates[256]; ep.clear(); if (GetKeyboardState((PBYTE)&keystates) == 0) // should use an async function? return; MCmodifierstate = querymods(); bool first = true; KeySym ksym; uint2 i; for (i = 0; i < 256; i++) { if (keystates[i] & 0x80) { ksym = i; if (i <= VK_LAST) { if (MCmodifierstate & MS_SHIFT || GetKeyState(VK_CAPITAL) & 0x1) ksym = shift_keysyms[i]; else ksym = keysyms[i]; } if (ksym > 0) { ep.concatuint(ksym, EC_COMMA, first); first = false; } } } }
void MCOldFontlist::getfontstyles(const char *fname, uint2 fsize, MCExecPoint &ep) { ep.clear(); if (MCnoui) return; MCOldFontnode dummynode; dummynode.buildtable(); MCOldFonttablenode *fnptr = dummynode.findtablenode(fname); if (fnptr != NULL) { uint2 i; for (i = 0 ; i < fnptr->nplain ; i++) { if (fnptr->psizes[i] == 0 || fnptr->psizes[i] == fsize) { ep.concatcstring(MCplainstring, EC_RETURN, true); if (fnptr->nbold > i && (fnptr->bsizes[i] == 0 || fnptr->bsizes[i] == fsize)) ep.concatcstring("bold", EC_RETURN, false); if (fnptr->nitalic > i && (fnptr->isizes[i] == 0 || fnptr->isizes[i] == fsize)) ep.concatcstring("italic", EC_RETURN, false); if (fnptr->nbolditalic > i && (fnptr->bisizes[i] == 0 || fnptr->bisizes[i] == fsize)) ep.concatcstring("bold-italic", EC_RETURN, false); break; } } } }
Exec_stat MCVideoClip::getprop(uint4 parid, Properties which, MCExecPoint &ep, Boolean effective) { switch (which) { case P_DONT_REFRESH: ep.setboolean(getflag(F_DONT_REFRESH)); break; case P_FRAME_RATE: if (flags & F_FRAME_RATE) ep.setint(framerate); else ep.clear(); break; case P_SCALE: ep.setnvalue(scale); break; case P_SIZE: ep.setint(size); break; case P_TEXT: { MCString s((const char *)frames, size); ep.setsvalue(s); } break; default: return MCObject::getprop(parid, which, ep, effective); } return ES_NORMAL; }
void MCScreenDC::getkeysdown(MCExecPoint &ep) { char kstring[U4L]; char km[32]; ep.clear(); MCmodifierstate = querymods(); XQueryKeymap(dpy, km); bool first = true; uint2 i; KeySym ksym; for (i = 0; i < 256; i++) { if (isKeyPressed(km, i)) { ksym = i; if (MCmodifierstate & MS_SHIFT || MCmodifierstate & MS_CAPS_LOCK) ksym = XKeycodeToKeysym(dpy, i, 1); else ksym = XKeycodeToKeysym(dpy, i, 0); if (ksym > 0) { ep.concatuint(ksym, EC_COMMA, first); first = false; } } } }
Exec_stat MCFontListLoaded(MCExecPoint& ep) { ep.clear(); for(MCLoadedFont *t_font = s_loaded_fonts; t_font != nil; t_font = t_font -> next) ep.concatcstring(t_font -> path, EC_RETURN, t_font == s_loaded_fonts); return ES_NORMAL; }
void MCFontlist::getfontsizes(const char *fname, MCExecPoint &ep) { ep.clear(); if (MCnoui) return; epptr = &ep; nfonts = 0; MCScreenDC *pms = (MCScreenDC *)MCscreen; HDC hdc = pms->getsrchdc(); EnumFontFamiliesA(hdc, fname, (FONTENUMPROCA)MyFontFamProc, FQ_SIZES); delete sizes; sizes = NULL; }
void MCDispatch::getmainstacknames(MCExecPoint &ep) { ep.clear(); MCExecPoint ep2(ep); MCStack *tstk = stacks; bool first; first = true; do { tstk->getprop(0, P_SHORT_NAME, ep2, False); ep.concatmcstring(ep2.getsvalue(), EC_RETURN, first); first = false; tstk = (MCStack *)tstk->next(); } while (tstk != stacks); }
void MCOldFontlist::getfontnames(MCExecPoint &ep, char *type) { ep.clear(); if (MCnoui) return; MCOldFontnode dummynode; dummynode.buildtable(); MCOldFonttablenode *table = dummynode.gettable(); MCOldFonttablenode *tmp = table; do { ep.concatcstring(tmp->name, EC_RETURN, tmp == table); tmp = tmp->next; } while (tmp != NULL); }
void MCOldFontlist::getfontsizes(const char *fname, MCExecPoint &ep) { ep.clear(); if (MCnoui) return; MCOldFontnode dummynode; dummynode.buildtable(); MCOldFonttablenode *fnptr = dummynode.findtablenode(fname); if (fnptr != NULL) { uint2 i; char buffer[U2L]; for (i = 0 ; i < fnptr->nplain ; i++) ep.concatuint(fnptr -> psizes[i], EC_RETURN, i == 0); } }
void MCFontlist::getfontstyles(const char *fname, uint2 fsize, MCExecPoint &ep) { ep.clear(); if (MCnoui) return; ep.setstaticcstring("plain\nbold\nitalic\nbold-italic"); #ifdef FOR_TRUE_TYPE_ONLY epptr = &ep; nfonts = 0; char mappedName[LF_FACESIZE]; mapfacename(mappedName, fname); MCScreenDC *pms = (MCScreenDC *)MCscreen; HDC hdc = pms->getmemsrchdc(); EnumFontFamiliesA(hdc, mappedName, (FONTENUMPROC)MyFontFamProc, FQ_STYLES); ep.lower(); #endif }
void MCFontlist::getfontnames(MCExecPoint &ep, char *type) { ep.clear(); if (MCnoui) return; epptr = &ep; nfonts = 0; MCScreenDC *pms = (MCScreenDC *)MCscreen; HDC hdc; #ifdef _DESKTOP // MM-2013-09-13:: [[ RefactorGraphics ]] Tweak to get things compiling for server. if (!MCU_strncasecmp(type, "Printer", strlen(type) + 1)) hdc = static_cast<MCWindowsPrinter *>(MCsystemprinter) -> GetDC(); else #endif hdc = pms->getsrchdc(); EnumFontFamiliesA(hdc, NULL, (FONTENUMPROCA)MyFontFamProc, FQ_NAMES); }
void SSL_ciphernames(MCExecPoint &ep) { #ifdef MCSSL // MW-2004-12-29: Integrate Tuviah's fixes static char sslcipherlist[] = "bf,128\nbf-cbc,128\nbf-cfb,128\nbf-ecb,128\nbf-ofb,128\nblowfish,128\ncast,128\ncast-cbc,128\ncast5-cbc,128\ncast5-cfb,128\ncast5-ecb,128\ncast5-ofb,128\ndes,64\ndes-cbc,64\ndes-cfb,64\ndes-ecb,64\ndes-ede,128\ndes-ede-cbc,128\ndes-ede-cfb,128\ndes-ede-ofb,128\ndes-ede3,192\ndes-ede3-cbc,192\ndes-ede3-cfb,192\ndes-ede3-ofb,192\ndes-ofb,64\ndes3,192\ndesx,192\ndesx-cbc,192\nrc2,128\nrc2-40-cbc,40\nrc2-64-cbc,64\nrc2-cbc,128\nrc2-cfb,128\nrc2-ecb,128\nrc2-ofb,128\nrc4,128\nrc4-40,40\nrc5,128\nrc5-cbc,128\nrc5-cfb,128\nrc5-ecb,128\nrc5-ofb,128"; isfirstcipher = True; ep.clear(); if (!InitSSLCrypt()) { char sslerrbuf[256]; SSLError(sslerrbuf); MCresult->copysvalue(sslerrbuf); } else OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH, list_ciphers_cb, &ep); #else // MW-2013-01-15: [[ Bug 10631 ]] Make sure we clear the return value if no // SSL! ep . clear(); #endif }
Exec_errors MCAsk::exec_password(MCExecPoint& ep, const char *p_title) { Exec_errors t_error = EE_UNDEFINED; Meta::cstring_value t_prompt, t_answer; MCresult -> clear(False); t_error = Meta::evaluate(ep, password . prompt, t_prompt, EE_ASK_BADREPLY, password . answer, t_answer, EE_ASK_BADREPLY); #ifndef _MOBILE if (!t_error) { bool t_cancelled; t_error = exec_custom(ep, t_cancelled, MCasknamestring, MCdialogtypes[mode], 3, p_title, *t_prompt, *t_answer); if (t_cancelled) MCresult -> sets(MCcancelstring); } #else if (!t_error) { char *t_result; t_result = MCscreen -> popupaskdialog(AT_PASSWORD, p_title, *t_prompt, *t_answer, password . hint); if (t_result != nil) ep . copysvalue(t_result); else { ep.clear(); MCresult -> sets(MCcancelstring); } delete t_result; } #endif return t_error; }
void MCA_getcolordialogcolors(MCExecPoint& p_ep) { p_ep.clear(); }
Exec_stat MCDispatch::getprop(uint4 parid, Properties which, MCExecPoint &ep, Boolean effective) { switch (which) { #ifdef /* MCDispatch::getprop */ LEGACY_EXEC case P_BACK_PIXEL: ep.setint(MCscreen->background_pixel.pixel & 0xFFFFFF); return ES_NORMAL; case P_TOP_PIXEL: ep.setint(MCscreen->white_pixel.pixel & 0xFFFFFF); return ES_NORMAL; case P_HILITE_PIXEL: case P_FORE_PIXEL: case P_BORDER_PIXEL: case P_BOTTOM_PIXEL: case P_SHADOW_PIXEL: case P_FOCUS_PIXEL: ep.setint(MCscreen->black_pixel.pixel & 0xFFFFFF); return ES_NORMAL; case P_BACK_COLOR: case P_HILITE_COLOR: ep.setstaticcstring("white"); return ES_NORMAL; case P_FORE_COLOR: case P_BORDER_COLOR: case P_TOP_COLOR: case P_BOTTOM_COLOR: case P_SHADOW_COLOR: case P_FOCUS_COLOR: ep.setstaticcstring("black"); return ES_NORMAL; case P_FORE_PATTERN: case P_BACK_PATTERN: case P_HILITE_PATTERN: case P_BORDER_PATTERN: case P_TOP_PATTERN: case P_BOTTOM_PATTERN: case P_SHADOW_PATTERN: case P_FOCUS_PATTERN: ep.clear(); return ES_NORMAL; case P_TEXT_ALIGN: ep.setstaticcstring(MCleftstring); return ES_NORMAL; case P_TEXT_FONT: ep.setstaticcstring(DEFAULT_TEXT_FONT); return ES_NORMAL; case P_TEXT_HEIGHT: ep.setint(heightfromsize(DEFAULT_TEXT_SIZE)); return ES_NORMAL; case P_TEXT_SIZE: ep.setint(DEFAULT_TEXT_SIZE); return ES_NORMAL; case P_TEXT_STYLE: ep.setstaticcstring(MCplainstring); return ES_NORMAL; #endif /* MCDispatch::getprop */ default: MCeerror->add(EE_OBJECT_GETNOPROP, 0, 0); return ES_ERROR; } }
void MCUIDC::getvendorstring(MCExecPoint &ep) { ep.clear(); }
Exec_stat MCObject::mode_getprop(uint4 parid, Properties which, MCExecPoint &ep, const MCString &carray, Boolean effective) { switch(which) { // MW-2010-07-09: [[ Bug 8848 ]] Previously scripts were being compiled into // separate hlists causing script local variable loss in the behavior // case. Instead we just use parsescript in non-reporting mode. case P_REV_AVAILABLE_HANDLERS: { bool t_first; t_first = true; ep . clear(); if (!effective) { parsescript(False); if (hlist != NULL) t_first = hlist -> enumerate(ep, t_first); } else { // MM-2013-09-10: [[ Bug 10634 ]] Make we search both parent scripts and library stacks for handlers. t_first = enumerate_handlers_for_list(MCfrontscripts, this, ep, t_first); for (MCObject *t_object = this; t_object != NULL; t_object = t_object -> parent) { t_object -> parsescript(False); t_first = enumerate_handlers_for_object(t_object, ep, t_first); } t_first = enumerate_handlers_for_list(MCbackscripts, this, ep, t_first); for (uint32_t i = 0; i < MCnusing; i++) { if (MCusing[i] == this) continue; t_first = enumerate_handlers_for_object(MCusing[i], ep, t_first); } } } break; // OK-2008-04-23 : Added for script editor case P_REV_AVAILABLE_VARIABLES: { ep.clear(); if (hlist == NULL) { return ES_NORMAL; } // A handler can be specified using array notation in the form <handler_type>,<handler_name>. // Where handler type is a single letter using the same conventation as the revAvailableHandlers. // // If a handler is specified, the list of variables for that handler is returned in the same format // as the variableNames property. // // If no handler is specified, the property returns the list of script locals for the object followed // by the list of script-declared globals. // // At the moment, no errors are thrown, just returns empty if it doesn't like something. if (carray == NULL) { hlist -> appendlocalnames(ep); ep . appendnewline(); hlist -> appendglobalnames(ep, true); return ES_NORMAL; } char *t_key; t_key = carray . clone(); if (t_key == NULL) return ES_NORMAL; char *t_comma; t_comma = strchr(t_key, ','); if (t_comma == NULL) { free(t_key); return ES_NORMAL; } // The handler name begins after the comma character char *t_handler_name_cstring; t_handler_name_cstring = t_comma + 1; // The handler code must be the first char of the string char t_handler_code; t_handler_code = *t_key; t_handler_code = MCS_toupper(t_handler_code); Handler_type t_handler_type; switch (t_handler_code) { case 'M': t_handler_type = HT_MESSAGE; break; case 'C': t_handler_type = HT_MESSAGE; break; case 'F': t_handler_type = HT_FUNCTION; break; case 'G': t_handler_type = HT_GETPROP; break; case 'S': t_handler_type = HT_SETPROP; break; default: t_handler_type = HT_MESSAGE; } MCAutoNameRef t_handler_name; /* UNCHECKED */ t_handler_name . CreateWithCString(t_handler_name_cstring); Exec_stat t_status; // The handler list class allows us to locate the handler, just return empty if it can't be found. MCHandler *t_handler; t_status = hlist -> findhandler(t_handler_type, t_handler_name, t_handler); if (t_status != ES_NORMAL) { free(t_key); return ES_NORMAL; } if (t_handler != NULL) t_handler -> getvarnames(ep, true); free(t_key); return ES_NORMAL; } break; default: return ES_NOT_HANDLED; } return ES_NORMAL; }
Exec_stat MCProperty::mode_eval(MCExecPoint& ep) { switch(which) { case P_REV_MESSAGE_BOX_LAST_OBJECT: if (MCmessageboxlastobject != NULL && MCmessageboxlastobject->Exists()) { MCmessageboxlastobject->Get()->names(P_LONG_ID, ep, 0); ep.concatnameref(MCmessageboxlasthandler, EC_COMMA, false); ep.concatuint(MCmessageboxlastline, EC_COMMA, false); if (MCmessageboxlastobject->Get()->getparentscript() != nil) { MCExecPoint ep2; MCmessageboxlastobject->Get()->getparentscript()->GetObject()->names(P_LONG_ID, ep2, 0); ep.concatmcstring(ep2.getsvalue(), EC_COMMA, false); } } else ep.clear(); break; case P_REV_MESSAGE_BOX_REDIRECT: if (MCmessageboxredirect != NULL) MCmessageboxredirect -> names(P_LONG_ID, ep, 0); else ep . clear(); break; case P_REV_LICENSE_LIMITS: ep.clear(); break; case P_REV_CRASH_REPORT_SETTINGS: ep.clear(); break; case P_REV_LICENSE_INFO: { if (ep . isempty()) { static const char *s_class_types[] = { "", "Community", "Commercial", "Professional", }; static const char *s_deploy_targets[] = { "Windows", "Mac OS X", "Linux", "iOS", "Android", "Windows Mobile", "Linux Mobile", "Server", "iOS Embedded", "Android Embedded", }; ep . clear(); ep . concatcstring(MClicenseparameters . license_name, EC_RETURN, true); ep . concatcstring(MClicenseparameters . license_organization, EC_RETURN, false); ep . concatcstring(s_class_types[MClicenseparameters . license_class], EC_RETURN, false); ep . concatuint(MClicenseparameters . license_multiplicity, EC_RETURN, false); ep . appendnewline(); if (MClicenseparameters . deploy_targets != 0) { bool t_first; t_first = true; for(uint32_t i = 0; i < 9; i++) { if ((MClicenseparameters . deploy_targets & (1 << i)) != 0) { ep . concatcstring(s_deploy_targets[i], EC_COMMA, t_first); t_first = false; } } } ep . appendnewline(); if (MClicenseparameters . addons != nil) { MCHashentry *t_entry; uint32_t t_index; bool t_first; t_first = true; t_entry = NULL; t_index = 0; for(;;) { t_entry = MClicenseparameters . addons -> get_array() -> getnextkey(t_index, t_entry); if (t_entry == NULL) break; ep . concatcstring(t_entry -> string, EC_COMMA, t_first); t_first = false; } } ep . concatcstring(MCnullmcstring == MClicenseparameters . license_token ? "Global" : "Local", EC_RETURN, false); } else { if (MClicenseparameters . addons == nil || MClicenseparameters . addons -> fetch_element(ep, ep . getsvalue(), false) != ES_NORMAL) ep . clear(); } } break; #ifdef FEATURE_PROPERTY_LISTENER // MM-2012-09-05: [[ Property Listener ]] case P_REV_OBJECT_LISTENERS: MCInternalObjectListenerListListeners(ep); break; case P_REV_PROPERTY_LISTENER_THROTTLE_TIME: ep.setnvalue(MCpropertylistenerthrottletime); break; #endif default: return ES_NOT_HANDLED; } return ES_NORMAL; }
Exec_stat MCPut::exec_cookie(MCExecPoint &ep) { char *t_name = NULL; char *t_value = NULL; char *t_path = NULL; char *t_domain = NULL; uint32_t t_name_len = 0; uint32_t t_value_len = 0; uint32_t t_path_len = 0; uint32_t t_domain_len = 0; uint32_t t_expires = 0; bool t_success = true; t_value = ep.getsvalue().clone(); t_value_len = ep.getsvalue().getlength(); t_success = (ES_NORMAL == name->eval(ep)); if (t_success) { t_name = ep.getsvalue().clone(); t_name_len = ep.getsvalue().getlength(); if (expires != NULL) t_success = expires->eval(ep); } if (t_success && expires) t_success = ep.isempty() || MCU_stoui4(ep.getsvalue(), t_expires); if (t_success && path) { t_success = path->eval(ep); if (t_success) { t_path = ep.getsvalue().clone(); t_path_len = ep.getsvalue().getlength(); } } if (t_success && domain) { t_success = domain->eval(ep); if (t_success) { t_domain = ep.getsvalue().clone(); t_domain_len = ep.getsvalue().getlength(); } } if(t_success) t_success = MCServerSetCookie(MCString(t_name, t_name_len), MCString(t_value, t_value_len), t_expires, MCString(t_path, t_path_len), MCString(t_domain, t_domain_len), is_secure, is_httponly); MCCStringFree(t_name); MCCStringFree(t_value); MCCStringFree(t_path); MCCStringFree(t_domain); if (!t_success) { MCeerror->add(EE_PUT_CANTSETINTO, line, pos); return ES_ERROR; } ep.clear(); return ES_NORMAL; }
Exec_stat MCF_unparsetextatts(Properties which, MCExecPoint &ep, uint4 flags, const char *name, uint2 height, uint2 size, uint2 style) { switch (which) { case P_TEXT_ALIGN: switch (flags & F_ALIGNMENT) { case F_ALIGN_LEFT: ep.setstaticcstring(MCleftstring); break; case F_ALIGN_CENTER: ep.setstaticcstring(MCcenterstring); break; case F_ALIGN_RIGHT: ep.setstaticcstring(MCrightstring); break; case F_ALIGN_JUSTIFY: ep.setstaticcstring(MCjustifystring); break; } break; case P_TEXT_FONT: ep.setsvalue(name); break; case P_TEXT_HEIGHT: ep.setint(height); break; case P_TEXT_SIZE: ep.setint(size); break; case P_TEXT_STYLE: { if (style == FA_DEFAULT_STYLE) { ep.setstaticcstring(MCplainstring); return ES_NORMAL; } uint32_t j; j = 0; ep.clear(); if (MCF_getweightint(style) != MCFW_MEDIUM) ep.concatcstring(MCF_getweightstring(style), EC_COMMA, j++ == 0); if (style & FA_ITALIC || style & FA_OBLIQUE) ep.concatcstring(MCF_getslantlongstring(style), EC_COMMA, j++ == 0); if (style & FA_BOX) ep.concatcstring(MCboxstring, EC_COMMA, j++ == 0); if (style & FA_3D_BOX) ep.concatcstring(MCthreedboxstring, EC_COMMA, j++ == 0); if (style & FA_UNDERLINE) ep.concatcstring(MCunderlinestring, EC_COMMA, j++ == 0); if (style & FA_STRIKEOUT) ep.concatcstring(MCstrikeoutstring, EC_COMMA, j++ == 0); if (style & FA_LINK) ep.concatcstring(MClinkstring, EC_COMMA, j++ == 0); if (MCF_getexpandint(style) != FE_NORMAL) ep.concatcstring(MCF_getexpandstring(style), EC_COMMA, j++ == 0); } break; default: break; } return ES_NORMAL; }
Exec_stat MCObject::getproparray(MCExecPoint &ep, uint4 parid, bool effective) { PropList *table; uint2 tablesize; switch (gettype()) { case CT_STACK: table = stackprops; tablesize = ELEMENTS(stackprops); break; case CT_CARD: table = cardprops; tablesize = ELEMENTS(cardprops); break; case CT_GROUP: table = groupprops; tablesize = ELEMENTS(groupprops); break; case CT_BUTTON: table = buttonprops; tablesize = ELEMENTS(buttonprops); break; case CT_FIELD: table = fieldprops; tablesize = ELEMENTS(fieldprops); break; case CT_IMAGE: table = imageprops; tablesize = ELEMENTS(imageprops); break; case CT_GRAPHIC: table = graphicprops; tablesize = ELEMENTS(graphicprops); break; case CT_SCROLLBAR: table = scrollbarprops; tablesize = ELEMENTS(scrollbarprops); break; case CT_PLAYER: table = playerprops; tablesize = ELEMENTS(playerprops); break; case CT_EPS: table = epsprops; tablesize = ELEMENTS(epsprops); break; case CT_COLOR_PALETTE: table = colorpaletteprops; tablesize = ELEMENTS(colorpaletteprops); break; case CT_AUDIO_CLIP: table = audioclipprops; tablesize = ELEMENTS(audioclipprops); break; case CT_VIDEO_CLIP: table = videoclipprops; tablesize = ELEMENTS(videoclipprops); break; default: return ES_NORMAL; } MCVariableValue *v = new MCVariableValue; v->assign_new_array(64); MCerrorlock++; while (tablesize--) { const char * t_token = table[tablesize].token; if ((Properties)table[tablesize].value > P_FIRST_ARRAY_PROP) getarrayprop(parid, (Properties)table[tablesize].value, ep, kMCEmptyName, effective); else { // MERG-2013-05-07: [[ RevisedPropsProp ]] Special-case the props that could // be either Unicode or native (ensure minimal encoding is used). // MERG-2013-06-24: [[ RevisedPropsProp ]] Treat the short name specially to ensure // round-tripping. If the name is empty, then return empty for 'name'. switch ((Properties)table[tablesize].value) { case P_SHORT_NAME: if (isunnamed()) ep.clear(); else getprop(parid, P_SHORT_NAME, ep, effective); break; case P_LABEL: getprop(parid, P_UNICODE_LABEL, ep, effective); if (!ep.trytoconvertutf16tonative()) { if (gettype() == CT_STACK) t_token = "unicodeTitle"; else t_token = "unicodeLabel"; } break; case P_TOOL_TIP: getprop(parid, P_UNICODE_TOOL_TIP, ep, effective); if (!ep.trytoconvertutf16tonative()) t_token = "unicodeToolTip"; break; case P_TEXT: if (gettype() == CT_BUTTON) { getprop(parid, P_UNICODE_TEXT, ep, effective); if (!ep.trytoconvertutf16tonative()) t_token = "unicodeText"; break; } default: getprop(parid, (Properties)table[tablesize].value, ep, effective); break; } } v->store_element(ep, t_token); } MCerrorlock--; ep.setarray(v, True); return ES_NORMAL; }
// MW-2005-05-15: Updated for new answer command restructuring int MCA_folder(MCExecPoint &ep, const char *p_title, const char *p_prompt, const char *p_initial, unsigned int p_options) { if (MCmajorosversion >= 0x0600 && MCModeMakeLocalWindows()) return MCA_file(ep, p_title, p_prompt, nil, p_initial, p_options | MCA_OPTION_FOLDER_DIALOG); // MW-2005-05-27: We'll use a static (I know bad me) to store the version // of the shell dll. static int s_shell_version = -1; static char *s_last_folder = NULL; char *t_native_filename; unsigned int t_native_filename_length; if (p_initial != NULL) { t_native_filename_length = strlen(p_initial); t_native_filename = (char *)_alloca(t_native_filename_length + 2); strcpy(t_native_filename, p_initial); MCU_path2native(t_native_filename); } else { t_native_filename = s_last_folder; t_native_filename_length = 0; } if (!MCModeMakeLocalWindows()) { MCRemoteFolderDialog(ep, p_title, p_prompt, t_native_filename); if (!ep.isempty()) { if (s_last_folder != NULL) delete s_last_folder; s_last_folder = ep.getsvalue().clone(); MCU_path2native(s_last_folder); } return 0; } if (s_shell_version == -1) s_shell_version = get_dll_version("shell32.dll"); bool sheet = (p_options & MCA_OPTION_SHEET) != 0; char *prompt = (char *)p_prompt; ep . clear(); BROWSEINFOA bi; memset(&bi, 0, sizeof(BROWSEINFO)); Window pw; pw = MCModeGetParentWindow(); if (pw != DNULL) bi.hwndOwner = (HWND)pw->handle.window; bi.pidlRoot = NULL; bi.lpszTitle = prompt; bi.ulFlags = BIF_RETURNONLYFSDIRS; if (s_shell_version >= 500) bi.ulFlags |= BIF_NEWDIALOGSTYLE; if (t_native_filename != NULL) { bi . lpfn = BrowseCallbackProc; bi . lParam = (LPARAM)t_native_filename; } else { bi.lpfn = NULL; bi.lParam = NULL; } LPITEMIDLIST lpiil; LPMALLOC lpm; char *tdir = NULL; SHGetMalloc(&lpm); DWORD t_error; lpiil = SHBrowseForFolderA(&bi); if (lpiil == NULL) { t_error = GetLastError(); } if (lpiil != NULL && SHGetPathFromIDListA(lpiil, ep.getbuffer(PATH_MAX))) { if (s_last_folder != NULL) delete s_last_folder; s_last_folder = strclone(ep . getbuffer(0)); MCU_path2std(ep.getbuffer(0)); ep.setstrlen(); } else { ep.clear(); MCresult->sets(MCcancelstring); } // SMR 1880 clear shift and button state waitonbutton(); lpm->Free(lpiil); lpm->Release(); return 0; }
void MCUIDC::getbeep(uint4 property, MCExecPoint &ep) { ep.clear(); }
void MCS_query_registry(MCExecPoint &dest, const char** type) { HKEY hkey; char *key = dest.getsvalue().clone(); //key = full path info such as: HKEY_LOCAL_MACHINE\\Software\\..\\valuename dest.clear(); /* get the value name, it is at the end of the key */ char *str = strrchr(key, '\\'); if (str == NULL) { //invalid key path specified MCresult->sets("no key"); delete key; return; } //chop off the end and make str point to the begining of the value name *str ++ = '\0'; char *VName = str; //VName now points to the name of the value to be queryed /* get the root key, it is at the begining of the key */ str = strchr(key, '\\'); if (str != NULL) /* key != HKEY_ROOT\.mc case */ *str ++ = '\0'; //str now pointing to the begining of subkey /** find the matching root key with the root string **/ uint2 i; MCString s = key; for (i = 0 ; i < ELEMENTS(Regkeys) ; i++) if (s == Regkeys[i].token) break; DWORD t_access; t_access = KEY_READ; if (MCmajorosversion >= 0x0501) { if (Regkeys[i].mode == kRegAccessAs32) t_access |= KEY_WOW64_32KEY; else if (Regkeys[i].mode == kRegAccessAs64) t_access |= KEY_WOW64_64KEY; } if (i >= ELEMENTS(Regkeys) || (RegOpenKeyExA(Regkeys[i].key, str, 0, t_access, &hkey) != ERROR_SUCCESS)) { MCresult->sets("bad key"); delete key; return; } //determine the size of value buffer needed LONG err = 0; DWORD VType; //value type DWORD VBufLen = 1; //value buffer len char *VValue; //value value err = RegQueryValueExA(hkey, VName, 0, NULL /*&VType*/, NULL, &VBufLen); if (err == ERROR_SUCCESS || err == ERROR_MORE_DATA) { VValue = new char[VBufLen]; //alloc space for the key value if ((err = RegQueryValueExA(hkey, VName, 0, &VType, (LPBYTE)VValue, &VBufLen)) == ERROR_SUCCESS && VBufLen) { DWORD t_original_buflen; t_original_buflen = VBufLen; if (VType == REG_SZ || VType == REG_EXPAND_SZ || VType == REG_MULTI_SZ) { while(VBufLen > 0 && VValue[VBufLen - 1] == '\0') VBufLen -= 1; if (VType == REG_MULTI_SZ && VBufLen < t_original_buflen) VBufLen += 1; } dest.copysvalue(VValue, VBufLen); //VBufLen - (VType == REG_SZ ? 1 : 0)); } // MW-2006-01-15: Memory Leak delete VValue; } else { errno = err; MCresult->sets("can't find key"); } RegCloseKey(hkey); delete key; if (type != NULL) for (i = 0 ; i < ELEMENTS(RegDatatypes) ; i++) if (VType == RegDatatypes[i].type) { *type = RegDatatypes[i] . token; break; } MCresult -> clear(); return; }
void MCS_query_registry(MCExecPoint &dest, const char** type) { MCresult->sets("not supported"); dest.clear(); }