PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) { if (isCurrent) { (void) setjmp(CONTEXT(t)); } *np = sizeof(CONTEXT(t)) / sizeof(PRWord); return (PRWord *) CONTEXT(t); }
/** cgi_set_main : function:0? -> void <doc>Set or disable the main entry point function</doc> **/ static value cgi_set_main( value f ) { if( val_is_null(f) ) { CONTEXT()->main = NULL; return val_true; } val_check_function(f,0); CONTEXT()->main = f; return val_true; }
PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) { #ifndef _PR_PTHREADS if (isCurrent) { (void) setjmp(CONTEXT(t)); } *np = sizeof(CONTEXT(t)) / sizeof(PRWord); return (PRWord *) CONTEXT(t); #else *np = 0; return NULL; #endif }
JNIEXPORT jint JNICALL Java_org_apache_commons_crypto_cipher_OpenSslNative_update (JNIEnv *env, jclass clazz, jlong ctx, jobject input, jint input_offset, jint input_len, jobject output, jint output_offset, jint max_output_len) { EVP_CIPHER_CTX *context = CONTEXT(ctx); if (!check_update_max_output_len(context, input_len, max_output_len)) { THROW(env, "javax/crypto/ShortBufferException", \ "Output buffer is not sufficient."); return 0; } unsigned char *input_bytes = (*env)->GetDirectBufferAddress(env, input); unsigned char *output_bytes = (*env)->GetDirectBufferAddress(env, output); if (input_bytes == NULL || output_bytes == NULL) { THROW(env, "java/lang/InternalError", "Cannot get buffer address."); return 0; } input_bytes = input_bytes + input_offset; output_bytes = output_bytes + output_offset; int output_len = 0; if (!dlsym_EVP_CipherUpdate(context, output_bytes, &output_len, \ input_bytes, input_len)) { dlsym_EVP_CIPHER_CTX_cleanup(context); THROW(env, "java/lang/InternalError", "Error in EVP_CipherUpdate."); return 0; } return output_len; }
JNIEXPORT jint JNICALL Java_com_intel_chimera_cipher_OpensslNative_doFinal (JNIEnv *env, jclass clazz, jlong ctx, jobject output, jint offset, jint max_output_len) { EVP_CIPHER_CTX *context = CONTEXT(ctx); if (!check_doFinal_max_output_len(context, max_output_len)) { THROW(env, "javax/crypto/ShortBufferException", \ "Output buffer is not sufficient."); return 0; } unsigned char *output_bytes = (*env)->GetDirectBufferAddress(env, output); if (output_bytes == NULL) { THROW(env, "java/lang/InternalError", "Cannot get buffer address."); return 0; } output_bytes = output_bytes + offset; int output_len = 0; if (!dlsym_EVP_CipherFinal_ex(context, output_bytes, &output_len)) { dlsym_EVP_CIPHER_CTX_cleanup(context); THROW(env, "java/lang/InternalError", "Error in EVP_CipherFinal_ex."); return 0; } return output_len; }
// get full path of a shell folder bool ShellDirectory::get_path(PTSTR path, size_t path_count) const { CONTEXT("ShellDirectory::get_path()"); if (!path || path_count==0) return false; path[0] = TEXT('\0'); if (_folder.empty()) return false; SFGAOF attribs = SFGAO_FILESYSTEM; // Split pidl into current and parent folder PIDLs ShellPath pidlParent, pidlFolder; _pidl.split(pidlParent, pidlFolder); if (FAILED(const_cast<ShellFolder&>(_folder)->GetAttributesOf(1, (LPCITEMIDLIST*)&pidlFolder, &attribs))) return false; if (!(attribs & SFGAO_FILESYSTEM)) return false; if (FAILED(path_from_pidl(get_parent_folder(), &*_pidl, path, path_count))) return false; return true; }
bool DesktopShellView::InitDragDrop() { CONTEXT("DesktopShellView::InitDragDrop()"); DesktopDropTarget * pDropTarget = new DesktopDropTarget(_hwnd); if (!pDropTarget) return false; pDropTarget->AddRef(); if (FAILED(RegisterDragDrop(_hwnd, pDropTarget))) { pDropTarget->Release(); return false; } FORMATETC ftetc; ftetc.dwAspect = DVASPECT_CONTENT; ftetc.lindex = -1; ftetc.tymed = TYMED_HGLOBAL; ftetc.cfFormat = CF_HDROP; pDropTarget->AddSuportedFormat(ftetc); pDropTarget->Release(); return true; }
static void restore_context(PARROT_INTERP, ARGIN(Parrot_Context * const initialctx)) { ASSERT_ARGS(restore_context) Parrot_Context *curctx = CONTEXT(interp); if (curctx != initialctx) { Parrot_warn((interp), PARROT_WARNINGS_NONE_FLAG, "popping context in Parrot_ext_try"); do { Parrot_pop_context(interp); curctx = CONTEXT(interp); if (curctx == NULL) PANIC(interp, "cannot restore context"); } while (curctx != initialctx); } }
JNIEXPORT jint JNICALL Java_com_intel_chimera_cipher_OpensslNative_updateByteArray (JNIEnv *env, jclass clazz, jlong ctx, jbyteArray input, jint input_offset, jint input_len, jbyteArray output, jint output_offset, jint max_output_len) { EVP_CIPHER_CTX *context = CONTEXT(ctx); if (!check_update_max_output_len(context, input_len, max_output_len)) { THROW(env, "javax/crypto/ShortBufferException", \ "Output buffer is not sufficient."); return 0; } unsigned char *input_bytes = (unsigned char *) (*env)->GetByteArrayElements(env, input, 0); unsigned char *output_bytes = (unsigned char *) (*env)->GetByteArrayElements(env, output, 0); if (input_bytes == NULL || output_bytes == NULL) { THROW(env, "java/lang/InternalError", "Cannot get buffer address."); return 0; } int output_len = 0; int rc = dlsym_EVP_CipherUpdate(context, output_bytes + output_offset, &output_len, \ input_bytes + input_offset, input_len); (*env)->ReleaseByteArrayElements(env, input, (jbyte *) input_bytes, 0); (*env)->ReleaseByteArrayElements(env, output, (jbyte *) output_bytes, 0); if (rc == 0) { dlsym_EVP_CIPHER_CTX_cleanup(context); THROW(env, "java/lang/InternalError", "Error in EVP_CipherUpdate."); return 0; } return output_len; }
int explorer_main(HINSTANCE hInstance, LPTSTR lpCmdLine, int cmdShow) { CONTEXT("explorer_main"); // initialize Common Controls library CommonControlInit usingCmnCtrl; try { InitInstance(hInstance); } catch(COMException& e) { HandleException(e, GetDesktopWindow()); return -1; } #ifndef ROSSHELL if (cmdShow != SW_HIDE) { /* // don't maximize if being called from the ROS desktop if (cmdShow == SW_SHOWNORMAL) ///@todo read window placement from registry cmdShow = SW_MAXIMIZE; */ explorer_show_frame(cmdShow, lpCmdLine); } #endif Window::MessageLoop(); return 1; }
JNIEXPORT jint JNICALL Java_org_apache_commons_crypto_cipher_OpenSslNative_doFinalByteArray (JNIEnv *env, jclass clazz, jlong ctx, jbyteArray output, jint offset, jint max_output_len) { EVP_CIPHER_CTX *context = CONTEXT(ctx); if (!check_doFinal_max_output_len(context, max_output_len)) { THROW(env, "javax/crypto/ShortBufferException", \ "Output buffer is not sufficient."); return 0; } unsigned char *output_bytes = (unsigned char *) (*env)->GetByteArrayElements(env, output, 0); if (output_bytes == NULL) { THROW(env, "java/lang/InternalError", "Cannot get buffer address."); return 0; } int output_len = 0; int rc = dlsym_EVP_CipherFinal_ex(context, output_bytes + offset, &output_len); (*env)->ReleaseByteArrayElements(env, output, (jbyte *) output_bytes, 0); if (rc == 0) { dlsym_EVP_CIPHER_CTX_cleanup(context); THROW(env, "java/lang/InternalError", "Error in EVP_CipherFinal_ex."); return 0; } return output_len; }
LRESULT MDIShellBrowserChild::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam) { switch(nmsg) { case PM_DISPATCH_COMMAND: { switch(LOWORD(wparam)) { case ID_WINDOW_NEW: { CONTEXT("MDIShellBrowserChild PM_DISPATCH_COMMAND ID_WINDOW_NEW"); MDIShellBrowserChild::create(_create_info); break; } case ID_REFRESH: ///@todo refresh shell child _shellBrowser->invalidate_cache(); break; case ID_VIEW_SDI: MainFrameBase::Create(ExplorerCmd(_url, false)); break; default: return super::WndProc(nmsg, wparam, lparam); } return TRUE; } default: return super::WndProc(nmsg, wparam, lparam); } return 0; }
void ShellBrowser::Init() { CONTEXT("ShellBrowser::Init()"); const String& root_name = GetDesktopFolder().get_name(_create_info._root_shell_path, SHGDN_FORADDRESSBAR); _root._drive_type = DRIVE_UNKNOWN; lstrcpy(_root._volname, root_name); _root._fs_flags = 0; lstrcpy(_root._fs, TEXT("Desktop")); _root._entry = new ShellDirectory(GetDesktopFolder(), _create_info._root_shell_path, _hwnd); _root._entry->read_directory(SCAN_DONT_ACCESS|SCAN_NO_FILESYSTEM); // avoid to handle desktop root folder as file system directory if (_left_hwnd) { InitializeTree(); InitDragDrop(); } jump_to(_create_info._shell_path); /* already filled by ShellDirectory constructor lstrcpy(_root._entry->_data.cFileName, TEXT("Desktop")); */ }
void ShellBrowser::OnTreeItemRClick(int idCtrl, LPNMHDR pnmh) { CONTEXT("ShellBrowser::OnTreeItemRClick()"); TVHITTESTINFO tvhti; GetCursorPos(&tvhti.pt); ScreenToClient(_left_hwnd, &tvhti.pt); tvhti.flags = LVHT_NOWHERE; (void)TreeView_HitTest(_left_hwnd, &tvhti); if (TVHT_ONITEM & tvhti.flags) { LPARAM itemData = TreeView_GetItemData(_left_hwnd, tvhti.hItem); if (itemData) { Entry* entry = (Entry*)itemData; ClientToScreen(_left_hwnd, &tvhti.pt); HRESULT hr = entry->do_context_menu(_hwnd, tvhti.pt, _cm_ifs); if (SUCCEEDED(hr)) refresh(); else CHECKERROR(hr); } } }
/*--------------------------------------------------------------------------- * Destroy element * * \param device * \param element *----------------------------------------------------------------------------*/ OWF_API_CALL WFCErrorCode WFC_Device_DestroyElement(WFC_DEVICE* device, WFCElement element) { WFCint i; WFCErrorCode result = WFC_ERROR_BAD_HANDLE; ENTER(WFC_Device_DestroyElement); FAIL_IF(NULL == device, WFC_ERROR_BAD_HANDLE); DPRINT(("destroying element %d", element)); for (i = 0; i < device->elements.length; i++) { WFC_ELEMENT* object; object = ELEMENT(OWF_Array_GetItemAt(&device->elements, i)); DPRINT((" element %d = %d", i, object->handle)); if (object->handle == element) { WFC_Context_RemoveElement(CONTEXT(object->context), element); WFC_Context_DecreaseClientElementCount(object->context); OWF_Array_RemoveItemAt(&device->elements, i); WFC_Element_Destroy(object); result = WFC_ERROR_NONE; break; } } LEAVE(WFC_Device_DestroyElement); return result; }
/*--------------------------------------------------------------------------- * Find context context object by handle * * \param device Device * \param context Context handle * * \return Corresponding context object or NULL * if handle is invalid. *----------------------------------------------------------------------------*/ OWF_API_CALL WFC_CONTEXT* WFC_Device_FindContext(WFC_DEVICE* device, WFCContext context) { WFCint i; WFC_CONTEXT* result = NULL; ENTER(WFC_Device_FindContext); FAIL_IF(NULL == device, NULL); for (i = 0; i < device->contexts.length; i++) { WFC_CONTEXT* ctmp; ctmp = CONTEXT(OWF_Array_GetItemAt(&device->contexts, i)); if (ctmp->handle == context) { result = ctmp; break; } } LEAVE(WFC_Device_FindContext); return result; }
OWF_API_CALL WFCboolean WFC_Device_FindScreenNumber(WFCint screenNumber) { WFCint i, j, deviceArrayLength, contextArrayLength; WFC_DEVICE* pDevice = NULL; ENTER(WFC_Device_DestroyContext); DPRINT(("WFC_Device_CheckScreenNumber(screenNumber = %d)", screenNumber)); deviceArrayLength = gPhyDevice.iDeviceInstanceArray.length; for (i = 0; i < deviceArrayLength; ++i) { pDevice = DEVICE(OWF_Array_GetItemAt(&(gPhyDevice.iDeviceInstanceArray), i)); OWF_ASSERT(pDevice); if (pDevice) { contextArrayLength = pDevice->contexts.length; for (j = 0; j < contextArrayLength; j++) { WFC_CONTEXT* pContext; pContext = CONTEXT(OWF_Array_GetItemAt(&pDevice->contexts, j)); OWF_ASSERT(pContext); if (pContext && (pContext->screenNumber == screenNumber)) { return WFC_TRUE; } } } } return WFC_FALSE; }
/*--------------------------------------------------------------------------- * Called from context's destructor to clean up any elements that * weren't added to any scene at all i.e. they only reside in the * device's element list. These elements must not stay alive after * the context has been deleted. *----------------------------------------------------------------------------*/ OWF_API_CALL void WFC_Device_DestroyContextElements(WFC_DEVICE* device, WFC_CONTEXT* context) { WFCint i; DPRINT(("WFC_Device_DestroyContextElements(device=%d, context=%d", device ? device->handle : 0, context ? context->handle : 0)); if (!device || !context) { return; } for (i = device->elements.length; i > 0; i--) { WFC_ELEMENT* element; element = ELEMENT(OWF_Array_GetItemAt(&device->elements, i-1)); if (element->context == context) { DPRINT((" Destroying element %d (%p)", element->handle, element)); /* Improvement idea: This code is partially same as in * WFC_Device_RemoveElement. Maybe the common part should * be isolated into some DoRemoveElement function which then * would be called from here and RemoveElement. */ WFC_Context_RemoveElement(CONTEXT(element->context), element->handle); OWF_Array_RemoveItemAt(&device->elements, i-1); WFC_Element_Destroy(element); } } }
BOOL ShellEntry::launch_entry(HWND hwnd, UINT nCmdShow) { CONTEXT("ShellEntry::launch_entry()"); SHELLEXECUTEINFO shexinfo; shexinfo.cbSize = sizeof(SHELLEXECUTEINFO); shexinfo.fMask = SEE_MASK_INVOKEIDLIST; // SEE_MASK_IDLIST is also possible. shexinfo.hwnd = hwnd; shexinfo.lpVerb = NULL; shexinfo.lpFile = NULL; shexinfo.lpParameters = NULL; shexinfo.lpDirectory = NULL; shexinfo.nShow = nCmdShow; ShellPath shell_path = create_absolute_pidl(); shexinfo.lpIDList = &*shell_path; // add PIDL to the recent file list SHAddToRecentDocs(SHARD_PIDL, shexinfo.lpIDList); BOOL ret = TRUE; if (!ShellExecuteEx(&shexinfo)) { display_error(hwnd, GetLastError()); ret = FALSE; } return ret; }
LRESULT ShellBrowserChild::Init() { CONTEXT("ShellBrowserChild::Init()"); ClientRect rect(_hwnd); const String& root_name = GetDesktopFolder().get_name(_create_info._root_shell_path, SHGDN_FORADDRESSBAR); _root._drive_type = DRIVE_UNKNOWN; lstrcpy(_root._volname, root_name); _root._fs_flags = 0; lstrcpy(_root._fs, TEXT("Desktop")); _root._entry = new ShellDirectory(GetDesktopFolder(), _create_info._root_shell_path, _hwnd); // -> set_curdir() _root._entry->read_directory(); if (_left_hwnd) { InitializeTree(); InitDragDrop(); } jump_to(_create_info._shell_path); return 0; }
IoObject *IoCairoContext_setSource(IoCairoContext *self, IoObject *locals, IoMessage *m) { IoCairoPattern *pattern = IoMessage_locals_valueArgAt_(m, locals, 0); cairo_set_source(CONTEXT(self), IoCairoPattern_rawPattern(pattern)); CHECK_STATUS(self); return self; }
void ShellBrowserChild::OnTreeGetDispInfo(int idCtrl, LPNMHDR pnmh) { CONTEXT("ShellBrowserChild::OnTreeGetDispInfo()"); LPNMTVDISPINFO lpdi = (LPNMTVDISPINFO)pnmh; ShellEntry* entry = (ShellEntry*)lpdi->item.lParam; if (entry) { if (lpdi->item.mask & TVIF_TEXT) lpdi->item.pszText = entry->_display_name; if (lpdi->item.mask & (TVIF_IMAGE|TVIF_SELECTEDIMAGE)) try { ShellPath pidl_abs = entry->create_absolute_pidl(); // Caching of absolute PIDLs could enhance performance. LPCITEMIDLIST pidl = pidl_abs; if (lpdi->item.mask & TVIF_IMAGE) lpdi->item.iImage = get_entry_image(entry, pidl, SHGFI_SMALLICON, _image_map); if (lpdi->item.mask & TVIF_SELECTEDIMAGE) lpdi->item.iSelectedImage = get_entry_image(entry, pidl, SHGFI_SMALLICON|SHGFI_OPENICON, _image_map_open); } catch(COMException&) { // ignore exception } } }
bool ShellBrowserChild::select_folder(ShellDirectory* dir, bool expand) { CONTEXT("ShellBrowserChild::expand_folder()"); if (!_last_sel) return false; if (!TreeView_Expand(_left_hwnd, _last_sel, TVE_EXPAND)) return false; for(HTREEITEM hitem=TreeView_GetChild(_left_hwnd,_last_sel); hitem; hitem=TreeView_GetNextSibling(_left_hwnd,hitem)) { if ((ShellDirectory*)TreeView_GetItemData(_left_hwnd,hitem) == dir) { if (TreeView_SelectItem(_left_hwnd, hitem)) { if (expand) if (!TreeView_Expand(_left_hwnd, hitem, TVE_EXPAND)) return false; return true; } break; } } return false; }
Session_Servant_Impl_T<BASE_SKEL, EXEC, CONTEXT>::Session_Servant_Impl_T ( EXEC * exe, Components::CCMHome_ptr home, const char * ins_name, Home_Servant_Impl_Base *home_servant, ::CIAO::Session_Container_ptr c) : CONTEXT::svnt_base_type (home, home_servant, c), activated_ (false), configuration_completed_ (false), executor_ (EXEC::_duplicate (exe)), context_ (0), ins_name_ (ins_name) { ACE_NEW (this->context_, CONTEXT (home, c, this, ins_name)); ::Components::SessionComponent_var scom = ::Components::SessionComponent::_narrow (exe); if (! ::CORBA::is_nil (scom.in ())) { scom->set_session_context (this->context_); } else { CIAO_DEBUG (6, (LM_DEBUG, CLINFO "Session_Servant_Impl_T_T::Session_Servant_Impl_T_T - " "Couldn't set session context for %C\n", ins_name)); } }
bool ShellBrowserChild::InitDragDrop() { CONTEXT("ShellBrowserChild::InitDragDrop()"); _pDropTarget = new TreeDropTarget(_left_hwnd); if (!_pDropTarget) return false; _pDropTarget->AddRef(); if (FAILED(RegisterDragDrop(_left_hwnd, _pDropTarget))) {//calls addref _pDropTarget->Release(); // free TreeDropTarget _pDropTarget = NULL; return false; } else _pDropTarget->Release(); FORMATETC ftetc; ftetc.dwAspect = DVASPECT_CONTENT; ftetc.lindex = -1; ftetc.tymed = TYMED_HGLOBAL; ftetc.cfFormat = CF_HDROP; _pDropTarget->AddSuportedFormat(ftetc); return true; }
FileChildWindow* FileChildWindow::create(const FileChildWndInfo& info) { CONTEXT("FileChildWindow::create()"); MDICREATESTRUCT mcs; mcs.szClass = CLASSNAME_WINEFILETREE; mcs.szTitle = (LPTSTR)info._path; mcs.hOwner = g_Globals._hInstance; mcs.x = info._pos.rcNormalPosition.left; mcs.y = info._pos.rcNormalPosition.top; mcs.cx = info._pos.rcNormalPosition.right - info._pos.rcNormalPosition.left; mcs.cy = info._pos.rcNormalPosition.bottom - info._pos.rcNormalPosition.top; mcs.style = 0; mcs.lParam = 0; FileChildWindow* child = static_cast<FileChildWindow*>( create_mdi_child(info, mcs, WINDOW_CREATOR_INFO(FileChildWindow,FileChildWndInfo))); if (!child->_left_hwnd && !child->_right_hwnd) { SendMessage(info._hmdiclient, WM_MDIDESTROY, (WPARAM)child->_hwnd, 0); MessageBox(info._hmdiclient, TEXT("Error opening child window"), TEXT("ROS Explorer"), MB_OK); } return child; }
/** set_return_code : int -> void <doc>Set the HTTP return code</doc> **/ static value set_return_code( value i ) { mcontext *c = CONTEXT(); val_check(i,int); HEADERS_NOT_SENT("Return code"); c->r->status = val_int(i); return val_true; }
JNIEXPORT void JNICALL Java_org_apache_commons_crypto_cipher_OpenSslNative_clean (JNIEnv *env, jclass clazz, jlong ctx) { EVP_CIPHER_CTX *context = CONTEXT(ctx); if (context) { dlsym_EVP_CIPHER_CTX_free(context); } }
JNIEXPORT void JNICALL Java_com_intel_chimera_cipher_OpensslNative_clean (JNIEnv *env, jclass clazz, jlong ctx) { EVP_CIPHER_CTX *context = CONTEXT(ctx); if (context) { dlsym_EVP_CIPHER_CTX_free(context); } }
/** redirect : string -> void <doc>Redirect the client to another page (Location header)</doc> **/ static value redirect( value s ) { mcontext *c = CONTEXT(); val_check(s,string); HEADERS_NOT_SENT("Redirection"); ap_table_set(c->r->headers_out,"Location",val_string(s)); c->r->status = REDIRECT; return val_true; }