Welcome![Sign In][Sign Up]
Location:
Search - Uint32

Search list

[Windows Develop征服4.0马端源码

Description: using System; using System.Collections.Generic; using System.Text; namespace NewestCOServer { public class Cryption { class CryptCounter { UInt16 m_Counter = 0; public byte Key2 { get { return (byte)(m_Counter >> 8); } } public byte Key1 { get { return (byte)(m_Counter & 0xFF); } } public void Increment() { m_Counter++; } } private CryptCounter _decryptCounter; private CryptCounter _encryptCounter; private byte[] _cryptKey1; private byte[] _cryptKey2; private byte[] _cryptKey3; private byte[] _cryptKey4; private bool Decrypt2 = false; public Cryption() { _decryptCounter = new CryptCounter(); _encryptCounter = new CryptCounter(); _cryptKey1 = new byte[0x100]; _cryptKey2 = new byte[0x100]; byte i_key1 = 0x9D; byte i_key2 = 0x62; for (int i = 0; i 4 | buffer[i] < 4 | buffer[i] < 4 | buffer[i] << 4); buffer[i] ^= (byte)(_cryptKey4[_decryptCounter.Key2] ^ _cryptKey3[_decryptCounter.Key1]); _decryptCounter.Increment(); } } } public void GenerateKeys(UInt32 CryptoKey, UInt32 AccountID) { UInt32 tmpkey1 = 0, tmpkey2 = 0; tmpkey1 = ((CryptoKey + AccountID) ^ (0x4321)) ^ CryptoKey; tmpkey2 = tmpkey1 * tmpkey1; _cryptKey3 = new byte[256]; _cryptKey4 = new byte[256]; for (int i = 0; i < 256; i++) { int right = ((3 - (i % 4)) * 8); int left = ((i % 4)) * 8 + right; _cryptKey3[i] = (byte)(_cryptKey1[i] ^ tmpkey1 left); _cryptKey4[i] = (byte)(_cryptKey2[i] ^ tmpkey2 left); } Decrypt2 = true; } public void GenerateKeys2(byte[] InKey1, byte[] InKey2) { byte[] addKey1 = new byte[4]; byte[] addKey2 = new byte[4]; byte[] addResult = new byte[4]; //addKey1.i = 0; //addKey2.i = 0; byte[] tempKey = new byte[4]; long LMULer; // InKey1[0] = 0x20; // InKey1[1] = 0x5c; // InKey1[2] = 0x48; // InKey1[3] = 0xf4; // InKey2[0] = 0x00; // InKey2[1] = 0x44; // InKey2[2] = 0xa6; // InKey2[3] = 0x2e; //if (Key3) delete [] Key3; //if (Key4) delete [] Key4; _cryptKey3 = new byte[256]; _cryptKey4 = new byte[256]; for (int x = 0; x < 4; x++) { addKey1[x] = InKey1[3 - x]; addKey2[x] = InKey2[3 - x]; } //cout << "Key1: " << addKey1.i << endl; //cout << "Key2: " << addKey2.i << endl; uint Adder1; uint Adder2; uint Adder3; Adder1 = (uint)((addKey1[3] << 24) | (addKey1[2] << 16) | (addKey1[1] << 8) | (addKey1[0])); Adder2 = (uint)((addKey2[3] << 24) | (addKey2[2] << 16) | (addKey2[1] 8) & 0xff); addResult[2] = (byte)((Adder3 >> 16) & 0xff); addResult[3] = (byte)((Adder3 >> 24) & 0xff); for (int b = 3; b >= 0; b--) { // printf("%.2x ", addResult.c[b]); tempKey[3 - b] = addResult[b]; } tempKey[2] = (byte)(tempKey[2] ^ (byte)0x43); tempKey[3] = (byte)(tempKey[3] ^ (byte)0x21); for (int b = 0; b < 4; b++) { tempKey[b] = (byte)(tempKey[b] ^ InKey1[b]); } //Build the 3rd Key for (int b = 0; b < 256; b++) { _cryptKey3[b] = (byte)(tempKey[3 - (b % 4)] ^ _cryptKey1[b]); } for (int x = 0; x < 4; x++) { addResult[x] = tempKey[3 - x]; } Adder3 = (uint)((addResult[3] << 24) | (addResult[2] << 16) | (addResult[1] << 8) | (addResult[0])); LMULer = Adder3 * Adder3; LMULer = LMULer 32; Adder3 = Convert.ToUInt32(LMULer & 0xffffffff); addResult[0] = (byte)(Adder3 & 0xff); addResult[1] = (byte)((Adder3 >> 8) & 0xff); addResult[2] = (byte)((Adder3 >> 16) & 0xff); addResult[3] = (byte)((Adder3 >> 24) & 0xff); for (int b = 3; b >= 0; b--) { tempKey[3 - b] = addResult[b]; } //Build the 4th Key for (int b = 0; b < 256; b++) { _cryptKey4[b] = Convert.ToByte(tempKey[3 - (b % 4)] ^ _cryptKey2[b]); } Decrypt2 = true; //cout << "Int representation: " << charadd.i << endl; } } }
Platform: | Size: 3638778 | Author: andesion@vip.qq.com | Hits:

[GUI Developbrew window manager

Description:

 

Objective
This topic describes how to create a windowed application that will share the display with other applications.
Brew® MP windowed applications need to be written differently than traditional Brew MP applications. Traditional Brew MP applications, when running in the foreground, occupy full screen space and can modify the display at any time. In the windowing framework, multiple applications share the display at the same time and are not allowed to modify the display arbitrarily. A windowed application also needs to create one or more widgets to be used to create the windows.
A windowed application needs to:
·                  Create and initialize one or more widgets to be passed to IWindowMgr_CreateWindow().
The application can implement its own IWidget, or it can make use of an existing IWidget.
·                  Handle the EVT_APP_START_WINDOW event (and create a window).
·                  Implement handlers for visibility changes, focus changes, and extent changes. The implementation of these handlers is dependent on the details of the application.
·                  Draw in two stages:
·                                  Tell the container that drawing is necessary (ICONTAINER_Invalidate()).
·                                  Draw only when told to draw by the container (IWIDGET_Draw()).
Note: A windowed application should not call any functions that modify IDisplay directly. This includes explicit IDisplay function calls or implicit updates, such as calls to IIMAGE_Draw() or ICONTROL_Redraw(). Drawing should happen only on demand, for example, when IWIDGET_Draw() is called for the widget used to create the window. Existing Widget based applications follow these guidelines and, with minor modifications, can be ported to the windowing framework.
Event handling
A windowed application must respond to these events:
EVT_APP_START_WINDOW and EVT_APP_START
A window-based application receives EVT_APP_START_WINDOW first. If the application returns TRUE for this event, the application does not receive EVT_APP_START. If an application needs to support both the environments (window based and non-window based), it should handle both events.
When the application receives EVT_APP_START_WINDOW, it should create one or more windows.
If creation of IWindowMgr0 fails while handling EVT_APP_START_WINDOW, the application should assume that the platform does not support window-based applications. In this case, the application should return FALSE and continue the application logic in the code for EVT_APP_START.
EVT_APP_SUSPEND and EVT_APP_RESUME
After an application returns TRUE for EVT_APP_START_WINDOW, it will not receive EVT_APP_SUSPEND and EVT_APP_RESUME as non-windowed Brew MP applications do. Instead, the application must check for window status events that are sent to the widget through EVT_WDG_SETPROPERTY events. For EVT_WDG_SETPROPERTY events, wParam indicates which property was set, and dwParam specifies the value of the property. When the AEEWindowMgrExt_PROPEX_STATE property has a value of AEEWindowMgrExt_STATE_VISIBLE, the window is visible.
EVT_WDG_WINDOWSTATUS
The EVT_WDG_WINDOWSTATUS event is sent to a widget to notify it about various window related status messages. AEEWindowStatus.h contains information on the meaning of various status messages.
Sample code location

ZIP filename
Location
Run app
hellowindowapp
Brew MP Library
·                       Download and extract the ZIP file.
·                       Compile the app.
·                       Run it on the Brew MP Simulator.

Example of a windowed application
In the hellowindowapp sample, HelloWindowApp_HandleEvent handles the EVT_APP_START_WINDOW event and creates soft key and pop-up windows:
   case EVT_APP_START_WINDOW:   
      DBGPRINTF("EVT_APP_START_WINDOW");
 
      // Create the softkey and popup windows
      HelloWindowApp_CreateSoftkey(pMe);
      HelloWindowApp_CreateOrActivatePopup(pMe);
 
      // Handling this event tells Brew that we are a windowing
      // application.
      return TRUE;  
HelloWindowApp_CreateSoftkey() creates the soft key widget, sets the color text of the widget, then calls HelloWindowApp_CreateWindow() to create the window.
   WidgetWindow *pWindow = &pMe->softkeyWindow;
  
   if (pWindow->piWindowWidget != NULL) return;
   pWindow->pszDbgName = "Softkey";
   pWindow->pMe = pMe;
  
   (void) ISHELL_CreateInstance(pMe->applet.m_pIShell, AEECLSID_SoftkeyWidget,
            (void **) &pWindow->piWindowWidget);
   if (pWindow->piWindowWidget == NULL) return;
 
   {
      WidgetExtent extent = {0, HWA_SOFTKEY_HEIGHT};
      IWidget_SetExtent(pWindow->piWindowWidget, &extent);
   }
  
   (void) IWidget_SetBGColor(pWindow->piWindowWidget, MAKE_RGBA(200,200,200,255));
  
   // Now set the softkeys text
   {
      IWidget *piTextWidget = NULL;
      (void) IWidget_GetSoftkey(pWindow->piWindowWidget, PROP_SOFTKEY1, &piTextWidget);
     
      if (piTextWidget != NULL) {
         (void) IWidget_SetText(piTextWidget, L"Hover", TRUE);
      }
      RELEASEIF(piTextWidget);
 
      (void) IWidget_GetSoftkey(pWindow->piWindowWidget, PROP_SOFTKEY2, &piTextWidget);
      if (piTextWidget != NULL) {
         (void) IWidget_SetText(piTextWidget, L"Close", TRUE);
      }
      RELEASEIF(piTextWidget);
   }
 
   HelloWindowApp_CreateWindow(pMe, pWindow, AEEWindowMgrExt_CLASS_Softkey);  
HelloWindowApp_CreateWindow() creates the soft key window, as follows:
   int result;
   uint32 winId;
   AEEWindowProp propList[1];
  
   // Set custom window handler
   HANDLERDESC_Init(&pWindow->hdHandler, HelloWindowApp_WindowHandler, pWindow, NULL);
   IWIDGET_SetHandler(pWindow->piWindowWidget, &pWindow->hdHandler);
        
   propList[0].id = AEEWindowMgrExtProp_CLASS;
   propList[0].pbyLen = sizeof(winClass);
   propList[0].pby = (void *) &winClass;
     
   result = IWindowMgr_CreateWindow(pMe->piWindowMgr, (IQI*) (void *) pWindow->piWindowWidget,
      propList, ARR_SIZE(propList), &winId);
 
   if (result != SUCCESS) {
      DBGPRINTF("Window creation failed for %s: %d", pWindow->pszDbgName, result);
      HelloWindowApp_DestroyWindow(pWindow);
   } else {
      DBGPRINTF("Window %s created: id=%d", pWindow->pszDbgName, winId);
   }
HelloWindowApp_CreateOrActivatePopup() creates the widget for the pop-up window, then calls HelloWindowApp_CreateWindow() to create the pop-up window.
   pWindow->piWindowWidget = HelloWindowApp_CreateAndInitImageWidget(
                                pMe,
                                "popups.main" // Image as defined in appinfo.ini
                             );
 
   if (pWindow->piWindowWidget == NULL) return;
 
   {
      WExtent extent = {HWA_POPUP_WIDTH, HWA_POPUP_HEIGHT};
      IWIDGET_SetExtent(pWindow->piWindowWidget, &extent);
   }
 
   HelloWindowApp_CreateWindow(pMe, pWindow, AEEWindowMgrExt_CLASS_Popup);
Related information
·                  See Brew MP Widgets Technology Guide: Creating a Widgets application
·                  See Brew MP API Reference

Base version:
Brew MP 1.0
Tested version:
Brew MP 1.0
Phone tested:
No

 

Platform: | Size: 439828 | Author: bluecrest | Hits:

[Internet-Networksd_test

Description: MMC_SD_SendCommand(uint8 cmd, uint32 arg)
Platform: | Size: 445440 | Author: wing | Hits:

[matlabconversion_gui

Description: function ret = Int2Hex(var) Prints integer array to hexadecimal string varType = class(var) cast signness away: if ( u ~= varType(1) ) varType = [ u varType] var = typecast(var,varType) end nBits = str2double(varType(5:end)) if (64 == nBits) split 64 bit case into two 32 s cuz dec2hex doesn t handle 64 bit... varType(5:end) = 32 var = typecast(var,varType) end ret = dec2hex(var) if (64 == nBits) littleEndian = all(typecast(uint32(1), uint16 )==[1 0]) first = 1 + littleEndian second = 2 - littleEndian ret = [ret(first:2:end,:),ret(second:2:end,:)] end end-function ret = Int2Hex(var) Prints integer array to hexadecimal string varType = class(var) cast signness away: if ( u ~= varType(1) ) varType = [ u varType] var = typecast(var,varType) end nBits = str2double(varType(5:end)) if (64 == nBits) split 64 bit case into two 32 s cuz dec2hex doesn t handle 64 bit... varType(5:end) = 32 var = typecast(var,varType) end ret = dec2hex(var) if (64 == nBits) littleEndian = all(typecast(uint32(1), uint16 )==[1 0]) first = 1 + littleEndian second = 2 - littleEndian ret = [ret(first:2:end,:),ret(second:2:end,:)] end end
Platform: | Size: 8192 | Author: thinkingbig4 | Hits:

[JSP/Javauint32

Description: uint32型数据的处理,js代码,可以转为其它的语言,大家可以参考!-uint32 type of data processing, js code, can be converted to other languages, you can refer!
Platform: | Size: 1024 | Author: PainDolor | Hits:

[Linux-UnixLinux-serial

Description: Linux 系统串口使用代码 /* * Program: serial.c * Author: Paul Dean * Version: 0.0.3 * Date: 2002-02-19 * Description: To provide underlying serial port function, * for high level applications. * */ #include <termios.h> /* tcgetattr, tcsetattr */ #include <stdio.h> /* perror, printf, puts, fprintf, fputs */ #include <unistd.h> /* read, write, close */ #include <fcntl.h> /* open */ #include <sys/signal.h> #include <sys/types.h> #include <string.h> /* bzero, memcpy */ #include <limits.h> /* CHAR_MAX */ #include "vardef.h" /* INT32, INT16, INT8, UINT32, UINT16, UINT8 */ #include "serial.h"-This directory contains the version 0.0.4 release of the Serial Debugger (SDB). The SDB is free software. If you think it is useful in your applications or solutions, you are admitted to use this source code with the declaration of Copyright to the original author, now Ding Baohua. Install procedure is referred to INSTALL file.
Platform: | Size: 8192 | Author: zhangxiaojun | Hits:

[Linux-Unixcls_align_uint32

Description: Check structure alignment of uint32.
Platform: | Size: 1024 | Author: vekengxo | Hits:

[CSharp2812SPI_communication-program

Description: 这是个2812SPI双机通信的程序实现的功能如下: 上位机发送请求电压命令:0x0003 0x1004 0x0004 +一个校验码,0003和1004为功能码 表示请求的是电压数据,0004表示要求4个变量,UXa,UXb,Uxc,UXd 下位机收到正确的命令(0x0003 0x1004 0x0004),并且验证码也正确后,向上位机返回数据, 数据格式如下:0x0003 0x0008 xxxx xxxx......xxxx +一个校验,0x0003是功能码,0x0008 是电压字数(我们的电压是Uint32型的),后面是8个变量和一个校验码 上位机接收到正确的功能码和电压字数后(0x0003 0x0008),开始接收数据,并对校验码进行校验,若正确则进行数据的存储。-This is SPI communication program
Platform: | Size: 6144 | Author: 大白痴 | Hits:

[Linux-Unixnv98

Description: uint32 t nv98 for Linux v2.13.6.
Platform: | Size: 5120 | Author: wlnuiweng | Hits:

[Linux-Unixvmwgfx_ioctl

Description: SVGA3D DEVCAP MAX sizeof(uint32 t) for Linux v2.13.6. -SVGA3D DEVCAP MAX sizeof(uint32 t) for Linux v2.13.6.
Platform: | Size: 3072 | Author: xnfanru | Hits:

[Linux-Unixnouveau_local

Description: struct nouveau pushbuf push, uint32 t data.
Platform: | Size: 2048 | Author: junbankj | Hits:

[Linux-Unixutypes

Description: Added typedefs for UClassID, int8, int16, int32, uint8, uint16, and uint32.
Platform: | Size: 11264 | Author: joqrcei | Hits:

[Program docunit8_2_double_

Description: 把从串口活其他端口接收到的数据转换成uint32型数据-data tranlate
Platform: | Size: 4096 | Author: l | Hits:

[Mapleunit8_2_uint32_

Description: 把从串口等地方获得的数据转换成uint32类型数据-data tranlate
Platform: | Size: 3072 | Author: l | Hits:

CodeBus www.codebus.net