2010年12月8日星期三

XP - 全自动开启匿名GUEST访问局域网共享

彻底解决winXP访问问题:
一、首先启用guest来宾帐户;
二、控制面板→管理工具→本地安全策略→本地策略→用户权利指派里

  • “从网络访问此计算机”中加入guest帐户
  • “拒绝从网络访问这台计算机”中删除guest帐户
三、我的电脑→工具→文件夹选项→查看→去掉“使用简单文件共享(推荐)”前的勾;
四、设置共享文件夹;
五、控制面板→管理工具→本地安全策略→本地策略→安全选项里,
  • 把“网络访问:本地帐户的共享和安全模式”设为“仅来宾-本地用户以来宾的身份验证”(可选,此项设置可去除访问时要求输入密码的对话框,也可视情况设为“经典-本地用户以自己的身份验证”);

2010年9月11日星期六

Build ARM code on Linux/eclipse


Know how to setup ARM toolchain;

(http://www.icdev.com.cn/?734/viewspace-653.html).

安装交叉编译环境

1. 安装标准的C开发环境,由于Ubuntu安装默认是不安装的,所以需要先安装一下:

sudo apt-get install gcc g++ libgcc1 libg++ make gdb

2.安装交叉编译器

从ftp://ftp.arm.linux.org.uk/pub/armlinux/toolchain/下载交叉编译器cross-3.2.tar.bz2,然后解压sudo tar jxvf /home/engelbert/cross-3.2.tar.bz2(/home/engelbert/为你存放cross-3.2.tar.bz2的路径),然后将解压后的文件都转移到/usr/local/下,

sudo mv /home/engelbert/usr/local/arm /usr/local

3.把交叉编译器的路径加入到PATH

sudo vi /etc/bash.bashrc

在后面加入如下代码:

if [ -d /usr/local/arm ] ; then

PATH=/usr/local/arm/bin:"${PATH}"

fi

4.使新的环境变量生效

# source /etc/profile

5.检查是否将路径加入PATH的方法:

echo $PATH

如果显示的内容中有/usr/local/arm/bin,说明已经将交叉编译器的路径加入PATH

自此,交叉编译环境安装完成。

下面我们就来测试一个简单的例子。

/*Hello.c*/

#include

3. main()

{

printf(hello ubuntu!\n);

}

程序输好以后确认无误,保存。进入程序文件所在目录

arm-linux-gcc hello.c –o hello(-o 可以理解为“目标为生成”)

arm-linux-gcc是第一次出现,有人可能会问这个哪里来的,不妨打开刚才安装的交叉编译工具目录/usr/local/arm-linux/arm-linux/bin/可以发现里面有一个arm-linux-gcc文件,这个就是针对arm的CPU的gcc编译器了。以后用其它编译工具链式也可以通过这种方法看看其编译器是什么了。编译好了以后就可以下载到目标机进行测试了。当然也可以先在PC机上测试正误。用gcc hello.c –o hello就可以生成PC机上程序了,在运行./hello 就可以发现终端显示hello!字样。用arm-linux-gcc编译的程序在PC机上是不能运行的,运行后给出错误报告:无法执行二进制文件。说明经过交叉编译环境编译出的文件是硬件可执行的二进制代码文件。







Put ARM toolchain in Eclipse

http://www.cnblogs.com/xubing/archive/2010/06/02/1749798.html

http://www.cnblogs.com/xubing/archive/2010/06/07/1752405.html

http://www.cnblogs.com/xubing/archive/2010/06/07/1753257.html

默认情况下,arm-linux-gcc会被解压到/usr/local/arm/4.3.2/目录中,其中,可执行文件存储在/usr/local/arm/4.3.2/bin中。解压成功后,我们需要修改环境变量,使得Linux可以找到arm-linux-gcc。使用gedit打开/etc/environment,在原有语句后面加上/usr/local/arm/4.3.2/bin。

我的/etc/environment是这样的:



PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/arm/4.3.2/bin"

注意:Linux中有3个级别的环境变量。这个/etc/environment是其中级别较高的一个。



如果我们修改私有的环境变量,Eclipse会提示无法找到arm-linux-gcc。必须修改/etc/environment,才能让Eclipse找到arm-linux-gcc。我猜测这是由于Eclipse运行于JAVA虚拟机上造成的。

至此,arm-linux-gcc就已经安装完成了,注销一下,再重新登录。打开一个终端,在里面输入arm-linux-gcc -v,如果返回了版本信息的话,就说明arm-linux-gcc安装成功了!







Re-use Android ARM toolchain both command line

http://www.pocketmagic.net/?p=682

Android uses a simplified version of libc, called bionic. We need to compile using Android's prebuilt cross-compiler arm-eabi-gcc, and use the bionic library on the phone.

The easy way to do this is to use the agcc perl wrapper. You can download the original file here, and modify

my $TOOLCHAIN = "$DROID/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1";

to

my $TOOLCHAIN = "$DROID/prebuilt/linux-x86/toolchain/arm-eabi-4.3.1";



Or download this updated version directly.

Copy agcc to your home directory, and chmod it:



chmod +x agcc



then set the PATH to the bionic libs and the agcc location:



$ PATH=$PATH:~/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.3.1/bin:~/:~/mydroid/

Now you can compile the test.c file:



agcc test.c -o test

Take the resulting test binary and upload it to your android using:



adb push test /data/local/test



Then run it:



adb shell

chmod 775 test

./test





2010年8月19日星期四

How to build Android source code from source.android.com

Start from the clean Ubuntu 10.04 install, and target to build the Android Éclair.
Learn from : http://devtcg.blogspot.com/2009/03/building-running-and-debugging-android.html
and http://mmmyddd.freeshell.net/wiki/android/build.html.

1. Follow the http://source.android.com/source/download.html instruction,

a) Setup the development environment:

i. $ sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev

ii. $ sudo apt-get install valgrind

2. install and use repo

a) $ curl http://android.git.kernel.org/repo > ~/bin/repo

b) $ chmod a+x ~/bin/repo

3. get source from source.android.com

a) $ mkdir ~/android/éclair; (this folder will be the root folder for build and debug, all command invoke will be from this folder).

b) $ cd ~/android/éclair

c) $ repo init -u git://android.git.kernel.org/platform/manifest.git -b éclair

Note: -b specified the branch, code name is the branch, like éclair, cupcake, donut and froyo.

d) $ repo sync

4. Build the eclair

a) Before build the android, some commands suggest to invoke:

i. $ source ./build/envsetup.sh

ii. $ lunch 1

b) Need export JAVA_HOME and add PATH

 $ export JAVA_HOME=/usr/lib/jvm/java-1.50-sun

 $ export ANDROID_JAVA_HOME=$JAVA_HOME

c) $ make

5. After build success, invoke the ./out/host/linux-x86/bin/emulator to start the android emulator.

6. Import the Android platform source code into eclipse. (we don’t need Android SDK and ADT tool, since we are going to debug the Android build-in application and all tools has been built in the folder ./out/host/linux-x86/bin. Follow the steps from http://source.android.com/source/using-eclipse.html.

Note: create a JAVA project. Not a Android project.

7. Launch ./out/hot/linux-x86/bin/ddms to start the debugging. Once ddms starts, attach the Android process on local machine port 8700 to debug.

8. Blocks the selected application from loading until a debugger attaches. This way you can set a breakpoint in onCreate(), which is important to debug the startup process of an Activity. When you change this option, any currently running instances of the selected application will be killed. In order to check this box, you must have selected a debug application as described in the previous option. You can do the same thing by adding waitForDebugger() to your code.

9 after add android.os.Debug.waitForDebugger(); in first line of onCreate of settings.jave, use following command to rebuild the module and image, of course shutdown the emulator first
$ mmm packages/apps/Settings // rebuild the settings apk
$ make snod // rebuild the system.img
then restart the emulator, select settings, now can attach and debug the application startup.





2010年8月16日星期一

Start using Ubuntu

Install the Ubuntu 10.04 today (08/16) on an external USB disk.
- Install KVpnc and vpnc for the VPN client;
- Install Skype;
- Install Eclipse, apt-get install eclipse (it will install the eclipse platform and JDT and OpenJDK);
- Install Sun Java JDK6;
- Install Android ADT and SDK;
- Install moonlight (silverlight) to listen the music online like "www.1ting.com"; 







2010年8月13日星期五

How to install Sun Java 1.5/1.6 on Ubuntu 10.04

Ubuntu (10.04) only supports Java 1.6 (and prefers OpenJDK too). Here's how to get Sun Java 1.5 installed on Ubuntu 10.04:



Add the following to /etc/apt/sources.list:

deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse

deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse



Update the package list:

sudo apt-get update



Install Sun Java 1.5/1.6:

sudo apt-get install sun-java5-jdk
sudo apt-get install sun-java6-jdk


Depending on your setup you might need to set this as the default. Check what version is default:

java -version


And list all Java versions installed:
sudo update-java-alternatives -l

Then if necessary:
sudo update-java-alternatives -s java-1.5.0-sun
or
sudo update-java-alternatives -s java-1.6.0-sun

2010年8月6日星期五

Learn Android from APK

1. Unpack the APK file by using apktool (http://code.google.com/p/android-apktool/).

Apktool will generate the readable XML files, include the AndroidMenifest.XML and layout XML files. It also will generate the Java bytecode from java class.

2. Rename the APK to ZIP and unzip it, get the DEX file. Using dex2jar (http://code.google.com/p/dex2jar/)
Generate the JAR file.

3. Get Java file by JD (http://java.decompiler.free.fr/).
Generate the java files

4. Using Source Insight to browser the code.

Google Android secret_code for launching hidden activity

Dial *#*#<code>#*#* to launch the hidden activities.

For example:
Dial <*#*#4636#*#*> will be received by "TestingSettingsBroadcastReceiver".

--Phone.java------------------------------------------------------------------------------
static boolean handleSecretCode(Context context, String input) {


// Secret codes are in the form *#*##*#*

int len = input.length();

if (len > 8 && input.startsWith("*#*#") && input.endsWith("#*#*")) {

Intent intent = new Intent(Intents.SECRET_CODE_ACTION,

Uri.parse("android_secret_code://" + input.substring(4, len - 4)));

context.sendBroadcast(intent);

return true;

}


return false;

}
------------------------------------------------------------------------------

<receiver android:name="TestingSettingsBroadcastReceiver">

<intent-filter>
<action android:name="android.provider.Telephony.SECRET_CODE" />
<data android:scheme="android_secret_code" android:host="4636" />
</intent-filter>
</receiver>
------------------------------------------------------------------------------

<receiver android:name="TestingSettingsBroadcastReceiver">

<intent-filter>
<action android:name="android.provider.Telephony.SECRET_CODE" />
<data android:scheme="android_secret_code" android:host="225" />
</intent-filter>
</receiver>




2010年7月23日星期五

Install XP/Windows 7 by command line

硬盘安装XP的实用方法:
用WINPE x86/x64启动, 运行:
winnt32.exe /syspart:c /tempdrive:c /makelocalsource

硬盘安装windows7:
1、imagex /apply d:\sources\install.wim 5 c: (注意,这里5是指ultimate版,要装其它版本把这个数字换成其它)
2、bcdboot c:\windows /s e: /l zh-CN (一条命令搞定bootmgr和bcd,并把启动菜单设成中文的)
3、bootsect /nt60 e: (写入c:盘的bootmgr引导扇区)   
启动即可继续安装.


硬盘安装windows7的高级实用方法:
1、把镜像用虚拟光驱加载,然后拷贝到任一硬盘分区中,我的是E:\windwos7。  


2、把E:\windwos7目录下的bootmgr和boot目录(其实只要里面的boot.sdi和bcd文件)拷贝到c盘根目录下,并在C盘根目录下建个sources文件夹。(原系统是vista的话需要取得权限,覆盖相应文件,取得权限的方法参照vista区的vista优化大师的右键取得管理权限法)  

3、把E:\windwos7\sources下的boot.win复制到C盘下sourse文件夹。  

4、用管理员身份运行cmd,然后输入c:\boot\bootsect.exe /nt60 c:

(注意,此处bootsect在c:\boot目录下),然后提示successful(即成功了!)
再将系统盘的卷名称改为英文:本地磁盘--bdcp  

5、重启计算机,正在启动安装程序  

6、安装程序启动,选择你要安装的语言类型,同时选择适合自己的时间和货币显示种类及键盘和输入方式。  

7、出现“开始安装界面”,(要注意了,不点击“现在安装”)点左下角“修复计算机”(repair my computer)。  

8、进入“系统恢复选项”,选择最后一项“命令提示符”(command prompt),进入DOS窗口。

9、执行格式化命令format c:/q(注:如C盘是FAT32格式,想转NTFS格式的话,执行format c:/fs:ntfs)。
注:此步可能需要输入卷的名称bdcp  

10、安装系统,输入E:windwos7sourcessetup.exe(注意文件路径是在E盘的windwos7文件夹下的sources文件里),之后就是正常的安装了。

2010年7月13日星期二

Visual Studio 2005 Remote Debugging to Vista and Windows 7

When you run MSVSMON.EXE on Vista and Windows 7, do you get the dreaded message indicating that you need to set the firewall, but when you do, MSVSMON.EXE errors out with an Incorrect Function message? After much struggle, I finally found the trick to remote debugging working correctly. Many thanks to this post on the MSDN Forums from Sam George.

It seems that even with the Vista SP1 Update, MSVSMON.EXE does not properly set the firewall. You'll need to set it up manually with the following batch file:


netsh advfirewall firewall add rule name="Microsoft Visual Studio Remote Debugger - UDP 137" dir=in action=allow enable=yes localport=137 protocol=udp

netsh advfirewall firewall add rule name="Microsoft Visual Studio Remote Debugger - UDP 138" dir=in action=allow enable=yes localport=138 protocol=udp

netsh advfirewall firewall add rule name="Microsoft Visual Studio Remote Debugger - TCP 139" dir=in action=allow enable=yes localport=139 protocol=tcp

netsh advfirewall firewall add rule name="Microsoft Visual Studio Remote Debugger - TCP 445" dir=in action=allow enable=yes localport=445 protocol=tcp

Of course, make sure you run the batch file from an elevated command prompt.

2010年7月1日星期四

无法解析外部符号 __security_cookie

1)选择“项目”-》“属性”-》“C/C++”-》“代码生成”-》“缓冲区安全检查”,设为“否”


2)选择“项目”-》“属性”-》“链接器”-》“输入”-》“附加依赖项”,增加”bufferoverflowU.lib”

http://support.microsoft.com/kb/894573.

2010年6月30日星期三

How To: compile Dolphin with SSE2, SSE3, SSE4.1, SSE4.2, and SSSE3 on Windows

General Requirements as suggested by me:


- WindowsXP or higher

- Nothing less than 2.1 GHz core2duo CPU

- No less than 3GB RAM

- No less than 10GB free on your Hard Drive.

-An extra $1400 laying around (no joke, you're actually gonna need this)



NOTE: If you can't afford it, you can get the builds for free from my website. You support me and save time and money.





Step 1: Get the Software

-Visual Studio 2008 Pro (yes PRO. There's no known workaround for Express) ($799)

-Intel C++ Compiler (version 11.1 Update 6 recommended) (Free to Try, $599.00 to buy)

-TortoiseSVN

-Latest DirectX SDK

-Windows SDK *May or may not be needed* (get version that's appropriate for your OS, ie Windows 7 requires Windows 7 SDK)

-Latest .NET Framework







Step 2: Installation

1) Install the latest version of the .NET Framework.



2) Install VS 2008 Pro (NOT Express!)

-FULL INSTALLATION!

-You may or may not need MSDN Library. I chose to install it.



3) Install Intel C++ Compiler

-FULL INSTALLATION (if IA-64 is disabled in the install, that's ok. That's the ONE thing you do not need...Unless you are building for IA-64 (instead of regular 64bit). If that's the case, you'll need VS 2008 Team Suite instead of Pro.)



4) Install Windows SDK, TortoiseSVN, and DirectX SDK



Step 3: Configuration

1) For Visual Studio (open Visual Studio)

-Under Tools > Options > Projects > VC++ Directories Select the Platform you will be building for. Make sure you have the following:

Under Executables: DirectX SDK Folder (Normally located: C:\Program Files\Microsoft DirectX SDK ([month and year released])\Utilities\bin\[x86 OR x64]

Under Includes: DirectX SDK Includes (Normally located: C:\Program Files\Microsoft DirectX SDK ([month and year released])\Include

Under Library: DirectX SDK Library (Normally located: C:\Program Files\Microsoft DirectX SDK ([month and year released])\Lib\[x86 OR x64]

Note: You can go to "Path Fixing" here if you need more detail.



Step 4: Checkout

1) Make a new folder and name it whatever. We'll refer to it as the "Checkout Folder."



2) Right-click the folder and select "SVN Checkout"



3) The URL of repository is "http://dolphin-emu.googlecode.com/svn/trunk/" without quotes.



4) Click OK or choose specific revision under "Revision" and then click OK.



Step 5: RVSN fixes

In your Checkout Folder there are some files we need to change to work with Intel C++ Compiler.



1) "_export" Fix

-Replace all instances of "_export" with "export_" (without quotes) in the following (you can use any text editor):

Checkout Folder\Source\Core\DolphinWX\Src\MemoryCards\WiiSaveCrypted.cpp

Checkout Folder\Source\Core\DolphinWX\Src\MemoryCards\WiiSaveCrypted.h



2) "VCEnd" fix (R5637 and later) Click here for an alternate method of fixing

-Replace all instances of "else (goto VCEnd" with "else (goto finish)" (without quotes) in the following (you can use any text editor):

CheckoutFolder\Source\Core\DolphinWX\DolphinWX.vcproj

CheckoutFolder\Source\Core\Common\Common.vcproj



-Replace all instances of "goto VCEnd" with ":finish" (without quotes) in the following (you can use any text editor):

CheckoutFolder\Source\Core\DolphinWX\DolphinWX.vcproj

CheckoutFolder\Source\Core\Common\Common.vcproj



NOTE: "2)" Must be done in the order shown to work correctly!

NOTE: I find that using NotePad++ to find and replace the code snippets is very quick and easy, as you can replace all instances of a value in all opened documents.













Step 6: Compiling

1) Open CheckoutFolder\Source\Dolphin.sln in VS 2008.



2) Right-click the "Solution 'Dolphin'" and select Intel C++ Compiler Pro -> Use Intel C++...



3) Click OK for any windows that pop-up.



4) Once it has finished converting the solution to use Intel C++, Select the Type of build you want (ie Debug/Release and Win32/x64 ("Release" is recomended))

Note: if you change either of these values after you change the following, you will have to redo the following steps.



5) Select all Projects in the Solution Explorer except DSPSpy, right-click them, and select click "Properties"



6) Under C++ -> Code Generation, you can set the Instruction Set used (ie SSE2, SSE3, SSE4.1, SSE4.2, or SSSE3).

-For Intel processors only: Set "Intel Processor-Specific Optimization"

-For all processors that support SSE instructions: Set "Add Processor-Optimized Code Path"



7) Click OK to apply settings.



8) Select "Plugin_VideoOGL" and all the projects under "Solution Explorer" that start with "wx" (without the quotes).



9) Right-Click and select properties. Under C++ -> Precompiled Headers set "Create/Use Precompiled Header" to "Not Using Precompiled Headers"



10) Right-click "Solution 'Dolphin'" and select "Rebuild"





You should end up with XX Succeeded, 0 failed, and X skipped. If you do not, either you missed one or more instructions in this tutorial, or their are specific settings needed for the revision you are trying to compile.



If you are not using an English OS and get error #13000, go here.





Step 7: Have Fun!

1) Where's my build?!

- It's under CheckoutFolder\Binary\{Win32 OR x64}\

-Just run "Dolphin{}.exe" (the {} stands for various things that may be appended, such as "FS" or "D" or nothing)



NOTE: Now that you know how to do this, you can find out what additional optimizations work for you! You can test your builds against mine to see if yours has a faster, slower, or about the same frame rate (remember to test the same rvsn number builds!)



Final words: (can anyone guess what they are lol) Free builds at my website! Go there, support me! yada yada yada... What better purpose for a tutorial than to advertise one's work lol







...And there you have it. What took 2 weeks of constant research and experimenting for me to learn you have learned in just 10 minutes.

convert between big-endian and little-endian values

Code:

inline void endian_swap(unsigned short& x)

{

x = (x>>8)


(x<<8);

}



inline void endian_swap(unsigned int& x)

{

x = (x>>24)


((x<<8) & 0x00FF0000)


((x>>8) & 0x0000FF00)


(x<<24);

}



// __int64 for MSVC, "long long" for gcc

inline void endian_swap(unsigned __int64& x)

{

x = (x>>56)


((x<<40) & 0x00FF000000000000)


((x<<24) & 0x0000FF0000000000)


((x<<8) & 0x000000FF00000000)


((x>>8) & 0x00000000FF000000)


((x>>24) & 0x0000000000FF0000)


((x>>40) & 0x000000000000FF00)


(x<<56);

}

在vista中跳过uac获得高权限

在window中(包括vista)最高权限是system account,拥有所有权限,该账户是专门为service配置的(个人猜测)。在vista中,在权限方面,微软使用了一种新的访问控制UAC,在administrators的帐户下面,用户启动进程的权限也仅仅是一般user的权限,若想使进程跑在administrator权限下面,就要使用run as administrator,通过uac使用户确认当前的操作,才能真正获得administrator的权限。vista使一般的程序跑在普通用户的权限下,提高了系统的安全性,但如果程序的确需要提高到 administrator的权限下才能正常工作(如调用驱动接口 etc)那么上述提高进程的流程比较繁琐。现在我们讲述另一种提高权限的方法,绕过uac。



该方法就是通过service来启动程序,这样就能提高权限到system account的级别(比administrator还高),因为service可以运行在system accout下面,(在servcie的配置中有logon选项设置,log on as system account.所以上面我说system account 专门为service配置)通过service运行的进程自然就具有了system account的权限。这个方法在windows xp下也经常使用,并且很容易实现,但是在vista下面就稍微有点麻烦,在vista下变麻烦是因为微软对service 运行的session有了改动。



那么下面先讲一下vista和xp下的针对service的改动,在xp下,service和app都是运行在同一个session的不同station下面,xp的第一个登陆账户运行在session 0中,所有的service 和app也都运行 在session中,第二个启动的账户运行在session 1中只有app,第三个类同第二个等。这样app和service运行在一个session中,那么app和service是很容易通信的 如 sendmessage mapfile pipe …etc,而在vista下,它把session 0 隔离了,成为service专用session ,所有的service都运行在session 0中,第一个账户运行在session 1中,第二个类同,这样在不同的session 下app和service通信就比较麻烦,需要global类通信如(name pipe,socket etc)。从上面的论述可以看出,微软这么改的目的也是为了安全性。



现在我们就开始讲提高进程的运行权限,先讲xp吧,这个比较容易。在xp下想要把进程提高到无所不能的system account权限,那就要做一个service,然后通过serivce启动进程。直接createprocess就可以实现了 ,简单吧。那么在vista下面呢,因为service在session 0下,所以不能直接createprocess去创建,因为这样创建出来的进程会跑在session 0 下面,而不是当前得user桌面下面。要用CreateProcessAsUser去创建,而该api需要一个当前session 下面的service token,听上去好复杂是不是,呵呵,其实也挺简单得,首先就是DuplicateTokenEx一个当前service的token 完成一步,然后修改成当前user的session ,这样就完成了。下面就看以下代码,这样就更容易理解了:



VOID RunAp()

{

HANDLE hUserTokenDup,hPToken,hProcess;

DWORD dwCreationFlags;

DWORD dwSessionId = WTSGetActiveConsoleSessionId();



hProcess =::GetCurrentProcess();

LOGVAR(_T("dwSessionId value : %u\n"),dwSessionId);

if(!::OpenProcessToken(hProcess,TOKEN_ALL_ACCESS,&hPToken))

{

int abcd = GetLastError();

LOGVAR(_T("Process token open Error: %u\n"),GetLastError());

}

DuplicateTokenEx(hPToken,MAXIMUM_ALLOWED,NULL,SecurityIdentification,TokenPrimary,&hUserTokenDup);



//change Token session id

if(! SetTokenInformation(hUserTokenDup,TokenSessionId,&dwSessionId,sizeof(DWORD)))

{

LOGVAR(_T("Set Token Information value Error: %u\n"),GetLastError());

}



//binding environment path

LPVOID pEnv =NULL;

dwCreationFlags = NORMAL_PRIORITY_CLASS
CREATE_NEW_CONSOLE;

if(CreateEnvironmentBlock(&pEnv,hUserTokenDup,TRUE))

{

dwCreationFlags
=CREATE_UNICODE_ENVIRONMENT;

}

else

pEnv=NULL;



// Launch the process in the client's logon session.

PROCESS_INFORMATION pi;

STARTUPINFO si;

ZeroMemory(&si, sizeof(STARTUPINFO));

si.cb= sizeof(STARTUPINFO);

si.lpDesktop = _T("winsta0\\default");

ZeroMemory(&pi, sizeof(pi));

CreateProcessAsUser(hUserTokenDup,

_T("E:\\SVN\\Shared\\FrameworkFoundation\\build\\debug\\bin\\PrivateSafe.exe"),

NULL,

NULL,

NULL,

FALSE,

dwCreationFlags,

pEnv,

NULL,

&si,

&pi

);

CloseHandle(hUserTokenDup);

CloseHandle(hPToken);

if(pEnv)

DestroyEnvironmentBlock (pEnv);



return ;

}