[UTIL][PB]★(¯ `•.MS ® Windows Phone - for Flash.Store.Bin[Ext/Build/Info/More].•´¯)★ - Windows Phone 7 Development and Hacking

[UTIL][PB]★(¯ `•.MS ® Windows Phone - for Flash.Store.Bin[Ext/Build/Info/More].•´¯)★
Now We have tool for Ext/Build/Mod./and More Flash.Store.bin
imgtool - Modyfication Image Store, extract/build/repartition/and more... for system
structure store partition, and general part sections image Windows Phone.
Support All Image Flash.Store.Bin Devices:
-- Toshiba/Dell/HTC/Samsung/Nokia/Etc...
Support Other Image System Devices:
-- bin|dio|xml|raw
Info - Usage:
Code:
ImgTool [...options...] inFile [outFile]
Info - Options:
Code:
Options:
-inFormat bin|dio|xml|raw Input file format
-inCert certificateFile Certificate for input file
-inBase address Raw image base address
-outFormat bin|xml|raw|secbin Output file format
-outHash sum|sha1 Output file hash
-outPvk privateKeyFile Private key for output hash
-outPvkPwd password Password for private key
-outCert certificateFile Certificate for output file
-ui Enable crypto user interface
-sectorSize bytes Output file sector size
-sectorsPerRecord sectors Output file sectors in record
-recordSize Output file maximal record size
-ram2store [...type...] Converts ram to storage image
-extendLast Set last partition size as unlimited
-extractPublicKey Extract public key from input certificate
Platform Info © 2012 By UPE-Product
All Rights Reserved

Support Example Format Store File - BOOT_DOWNLOAD_BIN_FORMAT_STORE:
Code:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.
//
#ifndef __BOOT_DOWNLOAD_BIN_FORMAT_H
#define __BOOT_DOWNLOAD_BIN_FORMAT_H
#include "bootTypes.h"
#ifdef __cplusplus
extern "C" {
#endif
#pragma pack(push, 1)
//------------------------------------------------------------------------------
#define BOOT_BIN_SIGNATURE_RAM "B000FF\x0A"
#define BOOT_BIN_SIGNATURE_SIGNED_RAM "S000FF\x0A"
#define BOOT_BIN_SIGNATURE_RAW "N000FF\x0A"
#define BOOT_BIN_SIGNATURE_SIGNED_RAW "R000FF\x0A"
#define BOOT_BIN_SIGNATURE_STORE "D000FF\x0A"
#define BOOT_BIN_SIGNATURE_JUMP "J00000\x0A"
//------------------------------------------------------------------------------
typedef struct BootBinFormatRamHeader_t {
uint32_t start;
uint32_t size;
} BootBinFormatRamHeader_t;
typedef struct BootBinFormatRamRecordHeader_t {
uint32_t address;
uint32_t length;
uint32_t checksum;
} BootBinFormatRamRecordHeader_t;
//------------------------------------------------------------------------------
typedef struct BootBinFormatSignature_t {
uint8_t signature[7];
} BootBinFormatSignature_t;
enum BootBinFormatFlags_e {
BOOT_BIN_FORMAT_FLAG_CLEAN = (1 << 0)
};
//------------------------------------------------------------------------------
enum BootBinFormatHashType_e {
BOOT_BIN_FORMAT_HASH_SUM = 0,
BOOT_BIN_FORMAT_HASH_SHA1 = 1,
BOOT_BIN_FORMAT_HASH_SHA256 = 2,
BOOT_BIN_FORMAT_HASH_OEM = 0x8000
// OEM can define new hashing algorithms in their own platform-specific
// BSPs. The definitions must start at BOOT_BIN_FORMAT_HASH_OEM, e.g.
// BOOT_BIN_FORMAT_HASH_ALG1 = BOOT_BIN_FORMAT_HASH_OEM + 0,
// BOOT_BIN_FORMAT_HASH_ALG2 = BOOT_BIN_FORMAT_HASH_OEM + 1
};
//------------------------------------------------------------------------------
typedef struct BootBinFormatStoreHeader_t {
uint32_t flags;
uint32_t sectorSize;
uint32_t sectors;
uint32_t segments;
uint32_t hashType;
uint32_t hashSize;
uint32_t hashInfoSize;
} BootBinFormatStoreHeader_t, *BootBinFormatStoreHeader;
typedef struct BootBinFormatStoreSha1Info_t {
uint32_t publicKeySize;
uint32_t seedSize;
/*
uint8_t publicKey[publicKeySize];
uint8_t seed[seedSize];
*/
} BootBinFormatStoreSha1Info_t;
enum BootBinFormatStoreSegmentType_e {
BOOT_BIN_FORMAT_STORE_SEGMENT_BINARY = 1,
BOOT_BIN_FORMAT_STORE_SEGMENT_RESERVED = 2,
BOOT_BIN_FORMAT_STORE_SEGMENT_PARTITION = 3
};
typedef struct BootBinFormatStoreSegmentHeader_t {
uint32_t type;
uint32_t sectors;
uint32_t infoSize;
} BootBinFormatStoreSegmentHeader_t, *BootBinFormatStoreSegmentHeader;
typedef struct BootBinFormatStoreSegmentBinaryInfo_t {
uint8_t index;
} BootBinFormatStoreSegmentBinaryInfo_t;
typedef struct BootBinFormatStoreSegmentReservedInfo_t {
char name[8];
} BootBinFormatStoreSegmentReservedInfo_t;
typedef struct BootBinFormatStoreSegmentPartitionInfo_t {
uint8_t fileSystem;
uint8_t index;
} BootBinFormatStoreSegmentPartitionInfo_t;
typedef struct BootBinFormatStoreRecordHeader_t {
uint32_t segment;
uint32_t sector;
uint32_t sectors;
} BootBinFormatStoreRecordHeader_t;
/*
This is pseudo-C definition of store format
typedef struct BootBinFormatStore_t {
uint8_t signature[7];
BootBinFormatStoreHeader_t header;
uint8_t hashInfo[header.hashInfoSize];
struct {
BootBinFormatStoreSegmentHeader_t segmentHeader;
union {
BootBinFormatStoreSegmentBinaryInfo_t binaryInfo;
BootBinFormatStoreSegmentReservedInfo_t reservedInfo;
BootBinFormatStoreSegmentPartitionInfo_t partitionInfo;
};
} segment[header.segments];
uint8_t hash[header.hashSize]; // Header hash/checksum
struct {
BootBinFormatStoreRecordHeader_t recordHeader;
uint8_t recordData[recordHeader.sectors * header.sectorSize];
uint8_t recordHash[header.hashSize];
} record[];
} BootBinFormatStore_t;
*/
//------------------------------------------------------------------------------
#pragma pack(pop)
#ifdef __cplusplus
}
#endif
#endif // __BOOT_DOWNLOAD_BIN_FORMAT_H

Related

Kinetic Scroller

hello guys. just want to share this code to you
PHP:
using System;
namespace FBScroller
{
using System.Windows.Forms;
using System.Drawing;
public class KineticScroller
{
/*
* Kinetic Scroller
* by: Jayson Ragasa
* supports Windows Forms and WinMobile Forms
* ---------------------------------------
* Code stripped from: Implementing a smoothly animated ListBox
* http://www.codeproject.com/KB/list/SmoothListBox.aspx
*
* by: Fredrik Bornander
* http://www.codeproject.com/Members/Fredrik-Bornander
* ---------------------------------------
* Usage:
* make a panel1 on a form
* KineticScroller.HorizontalScroller ks = new KineticScroller.HorizontalScroller(panel1, this);
* make a new panel2 inside panel1
* KineticScroller.VerticalScroller ks2 = new KineticScroller.VerticalScroller(panel2, panel1);
*/
public class VerticalScroller
{
#region vars
private Point previousPoint = new Point();
private int draggedDistance = 0;
private float velocity = 0.0f;
private bool mouseIsDown = false;
private Control _ctl;
private Control _root;
Timer t = new Timer();
#endregion
#region animation stuff
private float dragDistanceFactor = 50.0f;
public float DragDistanceFactor
{
set
{
if (value < 1.0f)
throw new ArgumentException("DragDistanceFactor must be greater than or equal to 1.0", "value");
dragDistanceFactor = value;
}
}
private float maxVelocity = 9000.0f;
public float MaxVelocity
{
set
{
if (value < 1.0f)
throw new ArgumentException("MaxVelocity must be greater than or equal to 1.0", "value");
maxVelocity = value;
}
}
private float deaccelerationFactor = 0.9000f;
public float DeAccelerationFactor
{
set
{
if (value <= 0.0f || value >= 1.0f)
throw new ArgumentException("DeaccelerationFactor must fall within exclusive range 0.0 < value < 1.0", "value");
deaccelerationFactor = value;
}
}
private float snapBackFactor = 0.2f;
public float SnapBackFactor
{
set
{
if (value <= 0.0f || value >= 1.0f)
throw new ArgumentException("SnapBackFactor must fall within exclusive range 0.0 < value < 1.0", "value");
snapBackFactor = value;
}
}
#endregion
public VerticalScroller(Control control, Control root)
{
t.Interval = 50;
t.Enabled = true;
t.Tick += new EventHandler(t_Tick);
_ctl = control;
_ctl.Location = new Point(0, 0);
_ctl.MouseDown += new MouseEventHandler(_ctl_MouseDown);
_ctl.MouseMove += new MouseEventHandler(_ctl_MouseMove);
_ctl.MouseUp += new MouseEventHandler(_ctl_MouseUp);
_root = root;
}
void _ctl_MouseUp(object sender, MouseEventArgs e)
{
//if (e.Button == MouseButtons.Left)
{
velocity = Math.Min(Math.Max(dragDistanceFactor * draggedDistance, -maxVelocity), maxVelocity);
draggedDistance = 0;
Animate();
}
mouseIsDown = false;
}
void _ctl_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Point absolutePoint = GetAbsolute(new Point(e.X, e.Y), _ctl, _root);
int delta = absolutePoint.Y - previousPoint.Y;
draggedDistance = delta;
Scroll(delta);
previousPoint = absolutePoint;
}
}
void _ctl_MouseDown(object sender, MouseEventArgs e)
{
mouseIsDown = true;
if (e.Button == MouseButtons.Left)
{
previousPoint = GetAbsolute(new Point(e.X, e.Y), _ctl, _root);
}
}
void t_Tick(object sender, EventArgs e)
{
Animate();
}
void Animate()
{
if (!mouseIsDown)
{
velocity *= deaccelerationFactor;
float elapsedTime = t.Interval / 1000.0f;
float deltaDistance = elapsedTime * velocity;
if (Math.Abs(deltaDistance) >= 1.0f)
{
Scroll((int)deltaDistance);
}
if (_ctl.Top != 0)
{
if (_ctl.Top > 0)
{
velocity = 0;
Scroll(-Math.Max(1, (int)(snapBackFactor * (float)(_ctl.Top))));
}
else
{
if (_ctl.Height > _root.ClientSize.Height)
{
int bottomPosition = _ctl.Top + _ctl.Height;
if (bottomPosition < _root.ClientSize.Height)
{
velocity = 0;
Scroll(Math.Max(1, (int)(snapBackFactor * (float)(_root.ClientSize.Height - bottomPosition))));
}
}
else
{
velocity = 0;
Scroll(Math.Max(1, -((int)(snapBackFactor * (float)_ctl.Top))));
}
}
}
}
}
void Scroll(int offset)
{
if (_ctl != null) _ctl.Top += offset;
}
private Point GetAbsolute(Point point, Control sourceControl, Control rootControl)
{
Point tempPoint = new Point();
for (Control iterator = sourceControl; iterator != rootControl; iterator = iterator.Parent)
{
tempPoint.Offset(iterator.Left, iterator.Top);
}
tempPoint.Offset(point.X, point.Y);
return tempPoint;
}
}
public class HorizontalScroller
{
#region vars
private Point previousPoint = new Point();
private int draggedDistance = 0;
private float velocity = 0.0f;
private bool mouseIsDown = false;
private Control _ctl;
private Control _root;
Timer t = new Timer();
#endregion
#region animation stuff
private float dragDistanceFactor = 50.0f;
public float DragDistanceFactor
{
set
{
if (value < 1.0f)
throw new ArgumentException("DragDistanceFactor must be greater than or equal to 1.0", "value");
dragDistanceFactor = value;
}
}
private float maxVelocity = 9000.0f;
public float MaxVelocity
{
set
{
if (value < 1.0f)
throw new ArgumentException("MaxVelocity must be greater than or equal to 1.0", "value");
maxVelocity = value;
}
}
private float deaccelerationFactor = 0.9000f;
public float DeAccelerationFactor
{
set
{
if (value <= 0.0f || value >= 1.0f)
throw new ArgumentException("DeaccelerationFactor must fall within exclusive range 0.0 < value < 1.0", "value");
deaccelerationFactor = value;
}
}
private float snapBackFactor = 0.2f;
public float SnapBackFactor
{
set
{
if (value <= 0.0f || value >= 1.0f)
throw new ArgumentException("SnapBackFactor must fall within exclusive range 0.0 < value < 1.0", "value");
snapBackFactor = value;
}
}
#endregion
public HorizontalScroller(Control control, Control root)
{
t.Interval = 50;
t.Enabled = true;
t.Tick += new EventHandler(t_Tick);
_ctl = control;
_ctl.Location = new Point(0, 0);
_ctl.MouseDown += new MouseEventHandler(_ctl_MouseDown);
_ctl.MouseMove += new MouseEventHandler(_ctl_MouseMove);
_ctl.MouseUp += new MouseEventHandler(_ctl_MouseUp);
_root = root;
}
void _ctl_MouseUp(object sender, MouseEventArgs e)
{
//if (e.Button == MouseButtons.Left)
{
velocity = Math.Min(Math.Max(dragDistanceFactor * draggedDistance, -maxVelocity), maxVelocity);
draggedDistance = 0;
Animate();
}
mouseIsDown = false;
}
void _ctl_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Point absolutePoint = GetAbsolute(new Point(e.X, e.Y), _ctl, _root);
int delta = absolutePoint.X - previousPoint.X;
draggedDistance = delta;
Scroll(delta);
previousPoint = absolutePoint;
}
}
void _ctl_MouseDown(object sender, MouseEventArgs e)
{
mouseIsDown = true;
if (e.Button == MouseButtons.Left)
{
previousPoint = GetAbsolute(new Point(e.X, e.Y), _ctl, _root);
}
}
void t_Tick(object sender, EventArgs e)
{
Animate();
}
void Animate()
{
if (!mouseIsDown)
{
velocity *= deaccelerationFactor;
float elapsedTime = t.Interval / 1000.0f;
float deltaDistance = elapsedTime * velocity;
if (Math.Abs(deltaDistance) >= 1.0f)
{
Scroll((int)deltaDistance);
}
if (_ctl.Left != 0)
{
if (_ctl.Left > 0)
{
velocity = 0;
Scroll(-Math.Max(1, (int)(snapBackFactor * (float)(_ctl.Left))));
}
else
{
if (_ctl.Width > _root.ClientSize.Width)
{
int rightPosition = _ctl.Left + _ctl.Width;
if (rightPosition < _root.ClientSize.Width)
{
velocity = 0;
Scroll(Math.Max(1, (int)(snapBackFactor * (float)(_root.ClientSize.Width - rightPosition))));
}
}
else
{
velocity = 0;
Scroll(Math.Max(1, -((int)(snapBackFactor * (float)_ctl.Left))));
}
}
}
}
}
void Scroll(int offset)
{
if (_ctl != null) _ctl.Left += offset;
}
private Point GetAbsolute(Point point, Control sourceControl, Control rootControl)
{
Point tempPoint = new Point();
for (Control iterator = sourceControl; iterator != rootControl; iterator = iterator.Parent)
{
tempPoint.Offset(iterator.Left, iterator.Top);
}
tempPoint.Offset(point.X, point.Y);
return tempPoint;
}
}
}
}
I stipped his code and made a class version of his smooth scroller and modified to make a Horizontal and Vertical scroller
Did you do any updates to his code?

[Q] root_plug

Not sure if this means anything, just throwing it out there, but i was going through file for froyo on the evo, original file name "supersonic-2.6.32.15-g746f4f0.tar" and found a file named root_plug-notepad, now i'm only guessing, but is this how they are blocking us from being able to root our device, or am i just guessing outta my arse.
on the notepad the full content is:
/*
* Root Plug sample LSM module
*
* Originally written for a Linux Journal.
*
* Copyright (C) 2002 Greg Kroah-Hartman
*
* Prevents any programs running with egid == 0 if a specific USB device
* is not present in the system. Yes, it can be gotten around, but is a
* nice starting point for people to play with, and learn the LSM
* interface.
*
* If you want to turn this into something with a semblance of security,
* you need to hook the task_* functions also.
*
* See for more information
* about this code.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, version 2 of the
* License.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/security.h>
#include <linux/usb.h>
#include <linux/moduleparam.h>
/* default is a generic type of usb to serial converter */
static int vendor_id = 0x0557;
static int product_id = 0x2008;
module_param(vendor_id, uint, 0400);
module_param(product_id, uint, 0400);
/* should we print out debug messages */
static int debug = 0;
module_param(debug, bool, 0600);
#define MY_NAME "root_plug"
#define root_dbg(fmt, arg...) \
do { \
if (debug) \
printk(KERN_DEBUG "%s: %s: " fmt , \
MY_NAME , __func__ , \
## arg); \
} while (0)
static int rootplug_bprm_check_security (struct linux_binprm *bprm)
{
struct usb_device *dev;
root_dbg("file %s, e_uid = %d, e_gid = %d\n",
bprm->filename, bprm->cred->euid, bprm->cred->egid);
if (bprm->cred->egid == 0) {
dev = usb_find_device(vendor_id, product_id);
if (!dev) {
root_dbg("e_gid = 0, and device not found, "
"task not allowed to run...\n");
return -EPERM;
}
usb_put_dev(dev);
}
return 0;
}
static struct security_operations rootplug_security_ops = {
.bprm_check_security = rootplug_bprm_check_security,
};
static int __init rootplug_init (void)
{
/* register ourselves with the security framework */
if (register_security (&rootplug_security_ops)) {
printk (KERN_INFO
"Failure registering Root Plug module with the kernel\n");
return -EINVAL;
}
printk (KERN_INFO "Root Plug module initialized, "
"vendor_id = %4.4x, product id = %4.4x\n", vendor_id, product_id);
return 0;
}
security_initcall (rootplug_init);
nobody, nothing, someone has to have some sort of input, lol.
pubbs.net/200910/kernel/36760-patchrfc-security-remove-rootplug.html
Uncle jimmy says hello

LG Optimus S Source

I'm not sure how this might help all of you V developers. But the official Gingerbread source was just posted a bit ago on the LG Open Source Code Distribution site for the Optimus S. It is not available in the LG Updater tool yet. I thought this might be useful for anyone developing for the V still.
Can you provide a link please?
Whyzor said:
Can you provide a link please?
Click to expand...
Click to collapse
http://www.lg.com/global/support/opensource/opensource.jsp
in the drop down box select mobile phones
in the other box type ls670
I was getting ready to compile this and give it a go and two questions came up
1) how do you change the keylayout from the kernel
2) the lg optimus v 2.2.2 kernel had some funny business going on if you used the kernel. If you type adb remount without changing the ramdisk you get
an error stating it's not allowed. But if you edit the default prop in the ramdisk to allow this then adb shell would mess up. Any one know how to fix
Asadullah said:
I was getting ready to compile this and give it a go and two questions came up
1) how do you change the keylayout from the kernel
2) the lg optimus v 2.2.2 kernel had some funny business going on if you used the kernel. If you type adb remount without changing the ramdisk you get
an error stating it's not allowed. But if you edit the default prop in the ramdisk to allow this then adb shell would mess up. Any one know how to fix
Click to expand...
Click to collapse
picasticks posted a diff between sprint vd and vm kernels.
diff
original blog post
here's the bit of the diff with the keycodes
Code:
diff -urP vd/kernel/arch/arm/mach-msm/lge/board-thunderc-input.c vm670/kernel/arch/arm/mach-msm/lge/board-thunderc-input.c
--- vd/kernel/arch/arm/mach-msm/lge/board-thunderc-input.c 2011-02-04 19:00:38.000000000 -0500
+++ vm670/kernel/arch/arm/mach-msm/lge/board-thunderc-input.c 2011-04-12 06:00:32.000000000 -0400
@@ -23,7 +23,6 @@
#include <mach/board.h>
#include <mach/board_lge.h>
#include <mach/rpc_server_handset.h>
-// LGE_CHANGE [[email protected]] 2010-07-18, check the pcb revision
#include <mach/board_lge.h>
#include "board-thunderc.h"
@@ -44,12 +43,6 @@
},
};
-/* None qwerty keypad device
- * For Thunder CDMA Keypad [ [email protected] ]
- * gpio key pad device - from keypad-surf-ffa */
-/* LGE_CHANGE [LS670:FW:[email protected]] 2010-05-05, add keys.
- * CAM_SHOT, CAM_AF, VOICE
- */
#if defined(CONFIG_MACH_MSM7X27_THUNDERC_SPRINT)
static unsigned int keypad_row_gpios[] = {
32, 33, 34
@@ -64,16 +57,10 @@
#define KEYMAP_INDEX(row, col) ((row)*ARRAY_SIZE(keypad_col_gpios) + (col))
-/* LGE_CHANGE [LS670:FW:[email protected]] 2010-05-05, add keys.
- * CAM_SHOT, CAM_AF, VOICE
- */
-/* LGE_CHANGE [[email protected]] 2010--05-15, modified the keymap
- * BACK <-> HOME
- */
#if defined(CONFIG_MACH_MSM7X27_THUNDERC_SPRINT)
static const unsigned short keypad_keymap_thunder[9] = {
- [KEYMAP_INDEX(0, 0)] = KEY_HOME,
- [KEYMAP_INDEX(0, 1)] = KEY_MENU,
+ [KEYMAP_INDEX(0, 0)] = KEY_MENU,
+ [KEYMAP_INDEX(0, 1)] = KEY_HOME,
[KEYMAP_INDEX(0, 2)] = KEY_VOLUMEUP,
[KEYMAP_INDEX(1, 0)] = KEY_SEARCH,
[KEYMAP_INDEX(1, 1)] = KEY_BACK,
I cut it short of the whole section it patches but you can see which file and the changes made.
also, I believe this bit here covers ADB shell, but I could be wrong:
Code:
diff -urP vd/kernel/arch/arm/mach-msm/lge/board-thunderc.c vm670/kernel/arch/arm/mach-msm/lge/board-thunderc.c
--- vd/kernel/arch/arm/mach-msm/lge/board-thunderc.c 2011-02-04 19:00:38.000000000 -0500
+++ vm670/kernel/arch/arm/mach-msm/lge/board-thunderc.c 2011-04-12 06:00:32.000000000 -0400
@@ -136,18 +136,39 @@
{
.product_id = 0x6003,
- .functions = 0x0F /* 001111 Modem,diag,NMEA,Mass*/
+ .functions = 0x0F /* 001111 Modem,diag,NMEA,Mass */
},
{
+ .product_id = 0x6004,
+ .functions = 0x1E /* 011110 diag,NMEA,Mass,ADB */
+ },
+
+ {
+ .product_id = 0x6005,
+ .functions = 0x19 /* 011001 Modem,Mass,ADB */
+ },
+
+ {
+ .product_id = 0x6006,
+ .functions = 0x09 /* 001001 Modem,ADB */
+ },
+
+ {
.product_id = 0x618E,
.functions = 0x1F /* 011111 Modem,diag,NMEA,Mass,ADB */
},
+
{
- // LGE_CHANGE [[email protected]] 2010-08-16, LS670 UMS PID: 0x61CC
- .product_id = 0x61CC,
+ .product_id = 0x61CE,
.functions = 0x08 /* 001000 Mass */
},
+
+ {
+ .product_id = 0x61A6,
+ .functions = 0x18 /* 011000 Mass,ADB */
+
+ },
};
#endif
@@ -157,9 +178,6 @@
.phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_65NM),
.vendor_id = 0x1004,
.product_name = "LG Android USB Device",
- /* LGE_CHANGE [[email protected]] 2010-05-22, change the serial_number
- * for LS670
- */
#ifdef CONFIG_MACH_MSM7X27_THUNDERC_SPRINT
.serial_number = "LGANDROIDLS670",
#else
@@ -194,7 +212,6 @@
},
};
-// LGE_CHANGE [[email protected]] 2010-09-28
static struct platform_device testmode_device = {
.name = "testmode",
.id = -1,
@@ -210,7 +227,6 @@
&msm_device_adspdec,
&lg_fw_diagcmd_device,
&lg_diag_cmd_device,
- // LGE_CHANGE [[email protected]] 2010-09-28
&testmode_device,
};
@@ -231,11 +247,6 @@
void msm_serial_debug_init(unsigned int base, int irq,
struct device *clk_device, int signal_irq);
-// LGE_CHANGE [[email protected]] 2010-07-22, merged from thunderg
-/* decrease FB pmem size because thunderg uses hvga
- * qualcomm's original value depends on wvga resolution
- * 2010-04-18, [email protected]
- */
unsigned pmem_fb_size = 0x96000;
unsigned pmem_adsp_size = 0xAE4000;
@@ -314,7 +325,6 @@
#endif
}
-/* LGE_CHANGE [[email protected]] 2010-06-02 [LS670] */
#ifdef CONFIG_MACH_MSM7X27_THUNDERC_SPRINT
MACHINE_START(MSM7X27_THUNDERC, "THUNDER Sprint board (LGE LS670)")
#else
hopefully that's what you're needing, but I'm not positive.
edit: looks like they changed the second bit quite a bit in 2.6.35, it'll take more work to patch in the changes for the v in the product id codes now.
FWIW in order to get USB tethering working, the IHO kernel does not use the stock VM670 USB code, so I wouldn't worry too much about patching anything or maintaining the USB IDs.

Unblocking thread safe queue - check code, please (and use, if right for you)

Hi friends.
I must solve big problem to finish HaRET (and other native applications) managed wrapper and UI (i. e. for example managed Silverlight UI controlled from unmanaged code), safe WP7 FTP client, interprocess cooperation on WP7, etc.
I know it is a basic issue, which is probably solved many time in operating systems (windows messages etc.) and many other examples.
But, I could find no any source code for queue, which is:
1. safe for more writers (threads from more processes) and for one reader,
2. unblocking for all writers,
3. unblocking for reader.
I found only very much unblocking ringbuffers or blocking queues, no one unblocking unlimited queue. Please, send corrections if I am bad looking.
Then, I tried code it...
First I want use std::queue with Thread Local Storage identifications (one subqueue for all writer and one abqueue for reader). But, TLS is very limited on CE based systems and I am not sure, if it solve interprocess safety too.
Finally, I tried to write the following code. It is designed for interthread queue only still, but interprocess can be added by safe named filemapping probably. Tell your opinion, it will be the basis for many complex applications here. For many years I have not worked with low-level synchronisation, I could make a fundamental mistake. So far I've missed templates and any wrapper, it's just the basic idea, usable in both C/C++ with very little changes:
PHP:
// This queue is unblocking and thread safe, when:
// 1. more writers are allowed,
// 2. one reader is allowed only.
// Motto: Pointers queue is both-directional, but frontal direction is changed by writers, backward direction by reader only!
#ifndef InterlockedExchangePointer
#define InterlockedExchangePointer(Target, Value) ((PVOID)InterlockedExchange((PLONG)(Target), (LONG)(Value)))
#endif
#ifndef InterlockedCompareExchangePointer
#define InterlockedCompareExchangePointer(Destination, ExChange, Comperand) ((PVOID)InterlockedCompareExchange((PLONG)(Destination), (LONG)(ExChange), (LONG)(Comperand)))
#endif
typedef struct SQItem
{
SQItem * pNext;
SQItem * pPrev;
void * pValue;
} * PItem;
SQItem EmptyItem = {NULL, NULL, NULL};
PItem pFront = &EmptyItem;
PItem pBack = &EmptyItem;
// Empty queue contains one item with both directions pointers nulled.
bool push_front(void * pNewValue) // nonblocking push, but theoretically forever cycle is possible for low priority thread! Practically improbable.
{
if (!pNewValue)
{
return false;
}
PItem pNewFront = new SQItem;
if (pNewFront)
{
PItem pProbablyFront;
InterlockedExchangePointer(&pProbablyFront, pFront);
pNewFront->pNext = pProbablyFront;
pNewFront->pPrev = NULL;
pNewFront->pValue = pNewValue;
while (InterlockedCompareExchangePointer(&pFront, pNewFront, pProbablyFront) != pProbablyFront)
{ // Another writer changed front pointer, active writer must try it again.
InterlockedExchangePointer(&pProbablyFront, pFront);
pNewFront->pNext = pProbablyFront;
}
return true; // Success allways.
}
return false; // Insufficient memory.
}
void * pop_back() // one reader allowed only!!!
{
PItem pBackward;
InterlockedExchangePointer(&pBackward, pFront); // Safe copy of actual front pointer
if (pBackward == pBack) // Queue is empty in time of interlocked attempt.
{
return NULL;
}
if (!pBack->pPrev)
{ // If backward queue is not continued here, reconstruct it from safe front pointer.
while (pBackward != pBack && !pBackward->pNext->pPrev)
{
pBackward->pNext->pPrev = pBackward;
pBackward = pBackward->pNext;
}
}
// One reader can safe read from back and manipulate with backward queue.
PItem pDelete = pBack;
pBack->pPrev->pNext = NULL;
pBack = pBack->pPrev;
delete pDelete;
return pBack->pValue;
/* // This is not necessary, but it is more clean:
void * pResult = pBack->pValue;
pBack->pValue = NULL;
return pResult;
*/
}
I am not sure, if heap allocation is not more "blocking" operation due to swapping and mm priorities, then object/signal waiting. What do you mean about it?
Mirror principle can be used to OneToMore queue making. Thanks unblocking, MoreToOne and OneToMore can be immeditelly piped to MoreToMore one.
But, when CE systems do not support two coupled pointers interlocked functions, there is no possibility to identify allowed reader safely, then this has not great significance.
As well, MoreToOne is much more needed now.
Template version
Using (simple example, the same way will be used between native threads and managed Silverlight UI):
Code:
#include "..\Templates\STQueue.h"
STQueue<tstring> qMessages(L"");
Code:
... // Called by [B]any thread[/B]:
void SafeMessage(tstring sMessage)
{
qMessages.push_front(sMessage);
PostMessage(hUnsafe, WM_FTP_MESSAGE, 0 , 0);
}
...
Code:
... // In UI thread:
LRESULT OnMsgMessage(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
bool bChange = false;
tstring szMessage = L"";
while ((szMessage = qMessages.pop_back()) != L"")
{
szMessages += szMessage;
szMessages += L"\r\n";
bChange = true;
}
if (bChange)
{
SetDlgItemText(hMainDlg, IDC_EDITMessage, szMessages.c_str());
}
return TRUE;
}
...
STQueue.h:
PHP:
template <class _Type> class STQItem
{
public:
STQItem<_Type> * pNext;
STQItem<_Type> * pPrev;
_Type Value;
STQItem(_Type & rV, STQItem<_Type> * pN = NULL, STQItem<_Type> * pP = NULL);
};
template <class _Type> class STQueue
{
protected:
STQItem<_Type> * pFront;
STQItem<_Type> * pBack;
_Type EmptyValue;
public:
STQueue(_Type EmptyV);
~STQueue();
bool push_front(const _Type & rNewValue);
const _Type & pop_back();
bool empty();
};
template <class _Type> STQItem<_Type>::STQItem(_Type & rV, STQItem<_Type> * pN, STQItem<_Type> * pP)
{
Value = rV;
pNext = pN;
pPrev = pP;
}
template <class _Type> STQueue<_Type>::STQueue(_Type EmptyV)
{
EmptyValue = EmptyV;
STQItem<_Type> * EmtyItem = new STQItem<_Type>(EmptyValue);
pFront = EmtyItem;
pBack = EmtyItem;
}
template <class _Type> STQueue<_Type>::~STQueue()
{
while (pop_back() != EmptyValue)
{
}
delete pBack;
}
template <class _Type> bool STQueue<_Type>::push_front(const _Type & rNewValue)
{ // nonblocking push, but theoretically forever cycle is possible for low priority thread!
STQItem<_Type> * pNewFront = new STQItem<_Type>(EmptyValue);
if (pNewFront)
{
STQItem<_Type> * pProbablyFront;
InterlockedExchangePointer(&pProbablyFront, pFront);
pNewFront->pNext = pProbablyFront;
pNewFront->pPrev = NULL;
pNewFront->Value = rNewValue;
while (InterlockedCompareExchangePointer(&pFront, pNewFront, pProbablyFront) != pProbablyFront)
{ // Another writer changed front pointer, active writer must try it again.
InterlockedExchangePointer(&pProbablyFront, pFront);
pNewFront->pNext = pProbablyFront;
}
return true; // Success allways.
}
return false; // Insufficient memory.
}
template <class _Type> const _Type & STQueue<_Type>::pop_back()
{ // one reader allowed only!!!
STQItem<_Type> * pBackward;
InterlockedExchangePointer(&pBackward, pFront); // Safe copy of actual front pointer
if (pBackward == pBack) // Queue is empty in time of interlocked attempt.
{
return EmptyValue;
}
if (!pBack->pPrev)
{ // If backward queue is not beginned, reconstruct it from safe front pointer.
while (pBackward != pBack && !pBackward->pNext->pPrev)
{
pBackward->pNext->pPrev = pBackward;
pBackward = pBackward->pNext;
}
}
// One reader can safe read from back and manipulate with backward queue.
STQItem<_Type> * pDelete = pBack;
pBack->pPrev->pNext = NULL;
pBack = pBack->pPrev;
delete pDelete;
return pBack->Value;
/* // This is not necessary, but it is more clean:
void * pResult = pBack->pValue;
pBack->pValue = NULL;
return pResult;
*/
}
template <class _Type> bool STQueue<_Type>::empty()
{
if(last==NULL)
return TRUE;
else
return FALSE;
}

[Q] How to read store.vol file Windows phone 7

Hello!
I have file store.vol copy from Windows phone device(HTC HD7). I use EDB API to read it.
My problem: I could not open store.vol file. ERROR_BAD_FORMAT.
How can I open this file.
Thanks!!!
My code:
Code:
#include "stdafx.h"
#include "Winphone7_Lib.h"
#include "clsReadEDB.h"
#include <iosfwd>
#define EDB
extern "C"
{
#include <windbase_edb.h>
}
// clsReadEDB
IMPLEMENT_DYNAMIC(clsReadEDB, CWnd)
clsReadEDB::clsReadEDB()
{
}
void clsReadEDB::readFile(char* path)
{
CEGUID guid;
CEVOLUMEOPTIONS cevo = {0};
cevo.wVersion = 1;
CEOIDINFOEX oidInfo = {0};
wchar_t buff[250];
HANDLE hSes, hBD, hBDS;
BOOL rez;
rez = CeMountDBVolEx(&guid, L"store.vol", &cevo,OPEN_EXISTING);
if (rez == FALSE) {
}
DWORD dw = GetLastError();
hBD = CeFindFirstDatabaseEx(&guid, 0);
if (hBD != INVALID_HANDLE_VALUE)
{
oidInfo.wVersion = CEOIDINFOEX_VERSION;
oidInfo.wObjType = OBJTYPE_DATABASE;
//creare sesiune
hSes = CeCreateSession(&guid);
if (hSes == INVALID_HANDLE_VALUE) {/* error */}
CEOID oidBD = CeFindNextDatabaseEx(hBD, &guid);
while (oidBD != 0)
{
//obtain database information
rez = CeOidGetInfoEx2(&guid, oidBD, &oidInfo);
if (rez != TRUE) {/* error */}
//open database
hBDS = CeOpenDatabaseInSession(hSes, &guid, &oidBD,
oidInfo.infDatabase.szDbaseName, NULL, CEDB_AUTOINCREMENT, NULL);
if (hBDS == INVALID_HANDLE_VALUE) {/* error */}
PCEPROPVAL pInreg = NULL;
PBYTE pBuffInreg = NULL;//memory is allocated by function
WORD wProp;//number of properties
DWORD dwLgInreg;// record lengths
//memory is allocatd by function
CEOID ceoid = CeReadRecordPropsEx(hBDS, CEDB_ALLOWREALLOC, &wProp, NULL,
&(LPBYTE)pBuffInreg, &dwLgInreg, NULL);
int k = 0;
while(ceoid != 0)
{
pInreg = (PCEPROPVAL)pBuffInreg;
//for each field
for (int i = 0; i < wProp; i++)
{
switch(LOWORD(pInreg->propid))
{
case CEVT_LPWSTR:
//process string values
break;
//integers
case CEVT_I2:
case CEVT_I4:
case CEVT_UI2:
case CEVT_UI4:
case CEVT_BLOB:
case CEVT_BOOL:
//process integer values
break;
case CEVT_R8:
//process floating point values
break;
default:
//other types
break;
}
OutputDebugString(buff);
//next field
pInreg++;
}
LocalFree(pBuffInreg);
//next record
ceoid = CeReadRecordPropsEx(hBDS, CEDB_ALLOWREALLOC, &wProp, NULL,
&(LPBYTE)pBuffInreg, &dwLgInreg, NULL);
k++;
}
CloseHandle(hBDS);
//next database
oidBD = CeFindNextDatabaseEx(hBD, &guid);
}
CloseHandle(hBD);
CloseHandle(hSes);
}
CeUnmountDBVol(&guid);
}
clsReadEDB::~clsReadEDB()
{
}

Categories

Resources