void CKeypad::KeyPressed(unsigned int keyCode) { s_keyPressedRT |= ID_TO_MASK(keyCode); int keyCode1 = GetDeviceKey(keyCode); s_keyPressedRT |= keyCode1; if ((keyCode1&STATE::GK_LEFT)!=0) { s_keyPressedRT&=~ STATE::GK_RIGHT; s_keyPressedRT&=~ STATE::GK_UP; s_keyPressedRT&=~ STATE::GK_DOWN; } if ((keyCode1&STATE::GK_RIGHT)!=0) { s_keyPressedRT&=~ STATE::GK_LEFT; s_keyPressedRT&=~ STATE::GK_UP; s_keyPressedRT&=~ STATE::GK_DOWN; } if ((keyCode1&STATE::GK_UP)!=0) { s_keyPressedRT&=~ STATE::GK_LEFT; s_keyPressedRT&=~ STATE::GK_RIGHT; s_keyPressedRT&=~ STATE::GK_DOWN; } if ((keyCode1&STATE::GK_DOWN)!=0) { s_keyPressedRT&=~ STATE::GK_LEFT; s_keyPressedRT&=~ STATE::GK_RIGHT; s_keyPressedRT&=~ STATE::GK_UP; } if ((keyCode1&STATE::GK_CENTER)!=0) { s_keyPressedRT&=~ STATE::GK_LEFT; s_keyPressedRT&=~ STATE::GK_RIGHT; s_keyPressedRT&=~ STATE::GK_DOWN; s_keyPressedRT&=~ STATE::GK_UP; } s_keyHold |= s_keyPressedRT; s_keyCurrent |= s_keyPressedRT; }
HRESULT Library_spot_native_Microsoft_SPOT_CryptoState::LoadSymmetricKey( CLR_RT_StackFrame& stack ) { TINYCLR_HEADER(); CLR_RT_HeapBlock* pThis; CLR_RT_HeapBlock_Array* array; pThis = stack.This() ; FAULT_ON_NULL(pThis); array = pThis[ Library_spot_native_Microsoft_SPOT_Cryptography_Key_TinyEncryptionAlgorithm::FIELD__m_value ].DereferenceArray(); FAULT_ON_NULL(array); memcpy( m_keySymmetric.Seed, array->GetFirstElement(), ARRAYSIZE(m_keySymmetric.Seed) ); if(pThis[ Library_spot_native_Microsoft_SPOT_Cryptography_Key_TinyEncryptionAlgorithm::FIELD__m_doublyEncrypted ].NumericByRefConst().u1 != 0) { KeySeed deviceKey; UINT8 iv[ TEA_KEY_SIZE_BYTES ]; memset( iv, 0, sizeof(iv) ); GetDeviceKey( (UINT8*)deviceKey.Seed ); ::Crypto_Decrypt( deviceKey.Seed, iv, sizeof(iv), m_keySymmetric.Seed, sizeof(m_keySymmetric.Seed), m_keySymmetric.Seed, sizeof(m_keySymmetric.Seed) ); } TINYCLR_NOCLEANUP(); }
int main(int argc, char** argv) { argc_main = argc; argv_main = argv; SplashColor paperColor; GooString* filename, *password; char* spwd; FILE* f = NULL; bookinfo* bi; char buf[1024]; int i; mkdir(CACHEDIR, 0777); chmod(CACHEDIR, 0777); spwd = GetDeviceKey(); if (setgid(102) != 0) fprintf(stderr, "warning: cannot set gid\n"); if (setuid(102) != 0) fprintf(stderr, "warning: cannot set uid\n"); if (spwd) { //fprintf(stderr, "password: %s\n", spwd); password = new GooString(spwd); } else { fprintf(stderr, "warning: cannot read password\n"); password = NULL; } OpenScreen(); signal(SIGFPE, sigfpe_handler); signal(SIGSEGV, sigsegv_handler); clock_left = GetThemeInt("panel.clockleft", 0); bmk_flag = GetResource("bmk_flag", NULL); if (argc < 2) { Message(ICON_WARNING, "PDF Viewer", "@Cant_open_file", 2000); return 0; } OriginalName = FileName = argv[1]; bi = GetBookInfo(FileName); if (bi->title) book_title = strdup(bi->title); // read config file globalParams = new GlobalParams(); globalParams->setEnableFreeType("yes"); globalParams->setAntialias((char*)(ivstate.antialiasing ? "yes" : "no")); globalParams->setVectorAntialias("no"); filename = new GooString(FileName); doc = new PDFDoc(filename, NULL, NULL); if (!doc->isOk()) { int err = doc->getErrorCode(); delete doc; if (err == 4) // encrypted file { filename = new GooString(FileName); doc = new PDFDoc(filename, NULL, password); if (!doc->isOk()) { delete doc; spwd = query_password(); password = new GooString(spwd); filename = new GooString(FileName); doc = new PDFDoc(filename, NULL, password); if (!doc->isOk()) { Message(ICON_WARNING, "PDF Viewer", "@Cant_open_file", 2000); return 0; } } } else { Message(ICON_WARNING, "PDF Viewer", "@Cant_open_file", 2000); return 0; } } npages = doc->getNumPages(); paperColor[0] = 255; paperColor[1] = 255; paperColor[2] = 255; splashOut = new MySplashOutputDev(USE4 ? splashModeMono4 : splashModeMono8, 4, gFalse, paperColor); splashOut->startDoc(doc->getXRef()); Outline* outline = doc->getOutline(); if (outline && outline->getItems()) { GooList* items = outline->getItems(); if (items->getLength() == 1) { OutlineItem* first = (OutlineItem*)items->get(0); first->open(); items = first->getKids(); update_toc(items, 0); first->close(); } else if (items->getLength() > 1) { update_toc(items, 0); } } DataFile = GetAssociatedFile(FileName, 0); f = fopen(DataFile, "rb"); if (f == NULL || fread(&docstate, 1, sizeof(tdocstate), f) != sizeof(tdocstate) || docstate.magic != 0x9751) { docstate.magic = 0x9751; docstate.page = 1; docstate.offx = 0; docstate.offy = 0; docstate.scale = 100; docstate.rscale = 150; docstate.orient = 0; docstate.nbmk = 0; } if (f != NULL) fclose(f); cpage = docstate.page; subpage = docstate.subpage; offx = docstate.offx; offy = docstate.offy; if (docstate.scale == 0) { scale = get_fit_scale(); ScaleZoomType = ZoomTypeFitWidth; } else { scale = docstate.scale; } rscale = docstate.rscale; reflow_mode = (docstate.orient & 0x80) ? 1 : 0; gcfg = GetGlobalConfig(); // ko = ReadInt(gcfg, "keeporient", 0); ko = -1; if (GetGlobalOrientation() == -1 || ko == 0) { orient = GetOrientation(); } else { orient = docstate.orient & 0x7f; SetOrientation(orient); } if (argc >= 3) { if (argv[2][0] == '=') { #ifdef USESYNOPSIS long long position; TSynopsisItem::PositionToLong(argv[2] + 1, &position); cpage = position_to_page(position >> 40); #else // cpage = atoi(position_to_page(argv[2] + 1)); cpage = atoi(argv[2] + 1); #endif } else {