20080411 java err masterpage javascript
http://www.yippeesoft.com
Error registering bean with name \’dataSource\’ defined in class path resource [TobaccoServer.xml]: Could not resolve placeholder \’hibernate.connection.driver_url\’
=[WARN ] 2008-04-10 21:02:50,046 method:org.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:71)
SQL Error: 17433, SQLState: null
=[ERROR] 2008-04-10 21:02:50,046 method:org.logicalcobwebs.proxool.Prototyper.sweep(Prototyper.java:105)
Prototype
不知道什么时候才可以不出这么弱的Bug。
Spring 的 DriverManager 在获得 SpringConfig.xml 文件中的数据时(如下格式)
<property name="url">
<value>jdbc:mysql://192.168.48.82:3306/iouyou?useUnicode=true&characterEncoding=UTF-8</value>
</property>
居然没有用 string.trim()。
情况是这样的:当在Eclipse中使用 Ctrl+F 布局config.xml 文件后,上面的格式会变化为:
<property name="url">
<value>
jdbc:mysql://192.168.48.82:3306/iouyou?useUnicode=true&characterEncoding=UTF-8
</value>
</property>
此时,Eclipse 做了XML格式的调整。当Spring DriverManager 获取变量的时候。获得的字段是
" jdbc:mysql://192.168.48.82:3306/iouyou?useUnicode=true&characterEncoding=UTF-8 "
(注意包含了前后的空格)因此,导致框架获得数据源出错。错误提示如下:
No suitable driver 。
安装Microsoft office xp 很长时间了,今天才发现有个Microsoft Script Editor。Microsoft Script Editor是Microsoft office xp的一个组件。在offic安装Microsoft office xp 很长时间了,今天才发现有个Microsoft Script Editor。Microsoft Script Editor是Microsoft office xp的一个组件。在office工具->宏->Microsoft 脚本编译器进行安装。都安好后,打开IE,在工具->internet选项->高级中,把禁用脚本调试(Internet Explorer)和禁用脚本调试(其他)前面的钩钩去掉。然后重新启动IE,当有JS错误的时候一路点是就会进入调试页面!
DB2的SQL1032N错误:SQL1032N 未发出启动数据库管理器的命令。 SQLSTATE=57019。
我遇到的情况是在WSAD中需要数据库联接时,提示启动速据库错误,有的时候是WSAD运行环境的错误,重启WSAD可以解决。也有很难解决的时候,找到的原因和解决方案如下:
原因一:DB2服务没有启动,在控制面板-管理工具-服务中启动DB2 – DB2-0服务;
原因二:启动错误,用户名密码在修改之后,WINDOWS将无法用旧的密码启动服务,因此,启动时修改用户名和密码,保证其正常启动。
原因三:许可证过期,这个错误是在网上搜到的,我没有遇到过,因为我的DB2 是永久版的,嘿嘿。 查看事件管理器,有这样的记录:DB2-DB2-0服务因4294959296服务性错误而停止.来源SERVICE CONTROL 事件ID:7024 。在db2cmd界面下运行db2licm -l,可以很明显的看到许可证已经过期了。
原因四:也不是自己遇到的情况:DB2的客户端连接不上server,提示如下:
C:\\Documents and Settings\\Administrator>db2 connect to fjdldw user install using install3211
SQL30081N 检测到通信错误。正在使用的通信协议:"TCP/IP"。正在使用的通信API:
"SOCKETS"。检测到错误的位置:"10.142.12.1"。检测到错误的通信函数:"connect"。协
议特定的错误代码:"10061"、"*"、"*"。 SQLSTATE=08001。
这个并不是TCP/IP协议的问题,到服务器上检查,会发现DB2实例未起来。
将任务管理器里的db2fmp进程全部杀掉,然后重新启动实例。db2start,OK!
小结:后来查了一查,db2fmp进程用于执行受保护的存储过程,或者自定义函数。出错的原因,尚不清楚。出了错误,多查查db2diag.log文件
Aspx页面套上了MasterPage后,使用Javascript使用无法读取服务器控件的值。
请教各位有什么好的办法吗?
服务器控件.ClientID,而不是直接使用服务器控件ID
masterpage里的元素ID前面全加上了ctl00$ContentPlaceHolder1$,好像是masterpage变成了一个控件,然后控件里面板里嵌套了html,如果这样就好理解了
<script language=javascript>
<!–
function CheckTextBox()
&leftsign;
var txtAgenNumber=document.getElementById("ctl00$ContentPlaceHolder1$txtAgenNumber");
var txtAgenName=document.getElementById("ctl00$ContentPlaceHolder1$txtAgenName");
var txtAgenPwd=document.getElementById("ctl00$ContentPlaceHolder1$txtAgenPwd");
var txtAgenPwd2=document.getElementById("ctl00$ContentPlaceHolder1$txtAgenPwd2");
if(txtAgenNumber.value=="")
&leftsign;
alert("代理账号不能为空!");
txtAgenNumber.focus();
return false;
&rightsign;
if(isNaN(txtAgenNumber.value))
&leftsign;
alert(\’代理账号必须是数字\’);
txtAgenNumber.focus();
return false;
&rightsign;
if(txtAgenName.value=="")
&leftsign;
alert("姓名不能为空!");
txtAgenName.focus();
return false;
&rightsign;
if(txtAgenPwd.value==""&line;&line;txtAgenPwd2.value=="")
&leftsign;
alert("密码不能为空!");
txtAgenPwd.focus();
return false;
&rightsign;
&rightsign;
–>
</script>
if you use strong-type, like
<%@ MasterType virtualPath="~/MasterPage.master"%>
you can call the method directly!
Master.YourMethod1();
20071024 kvm uclinux
http://www.yippeesoft.com
错误一大堆~~~~~~
[root@mobile build]# make
mkdir -p obj
mkdir -p fp_obj
… obj/cache.o
arm-elf-gcc: unrecognized option `-Xa\’
arm-elf-gcc: language O2 not recognized
arm-elf-gcc: ../../../kvm/VmCommon/src/cache.c: linker input file unused since linking not done
… obj/class.o
用ARM-UCLINUX-GCC
../../../kvm/VmUnix/src/runtime_md.c: In function `InitializeFloatingPoint\’:
../../../kvm/VmUnix/src/runtime_md.c:171: error: `_FPU_EXTENDED\’ undeclared (first use in this function)
../../../kvm/VmUnix/src/runtime_md.c:171: error: (Each undeclared identifier is reported only once
../../../kvm/VmUnix/src/runtime_md.c:171: error: for each function it appears in.)
../../../kvm/VmUnix/src/runtime_md.c:171: error: `_FPU_DOUBLE\’ undeclared (first use in this function)
用ARM-ELF-GCC
/tmp/ccmzsd5d.s: Assembler messages:
/tmp/ccmzsd5d.s:301: Error: bad instruction `fldcw [fp,#-14]\’
#error Attempted to include iconv.h when uClibc built without locale support.
In file included from ../../src/convert_md.c:22:
/usr/local/arm-uclinux-tools/lib/gcc/arm-uclinux/3.4.0/../../../../arm-uclinux/include/iconv.h:27:2: #error Attempted to include iconv.h when uClibc built without locale support.
../../src/convert_md.c: In function `native2utf8\’:
../../src/convert_md.c:86: warning: passing arg 2 of `iconv\’ from incompatible pointer type
../../src/convert_md.c: In function `utf2native\’:
../../src/convert_md.c:117: warning: passing arg 2 of `iconv\’ from incompatible pointer type
Version 1.0 of the CLDC Specification did not require floating-point arithmetic in compliant implementations. However, the CLDC Specification Version 1.1 does require floating-point, and this chapter describes the implications for porting the floating-point implementation for KVM in CLDC 1.1.
[root@mobile linux]# make
/usr/local/arm-uclinux-tools/bin/arm-uclinux-gcc /home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crt0.o /home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crtl.o /home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crtn.o -o preverify check_class.o main.o utf.o check_code.o convert_md.o util.o jar.o jar_support.o classloader.o file.o classresolver.o stubs.o inlinejsr.o sys_support.o
arm-uclinux-gcc: /home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crtl.o: No such file or directory
loader.o file.o classresolver.o stubs.o inlinejsr.o sys_support.o
/home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crt0.o: In function `_start\’:
/home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crt0.o(.text+0×0): multiple definition of `_start\’
/usr/local/arm-elf/lib/crt0.o(.text+0×0): first defined here
/home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crt0.o: In function `_start\’:
/home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crt0.o(.text+0×0): multiple definition of `_start\’
/usr/local/arm-elf/lib/crt0.o(.text+0×0): first defined here
main.o(.text+0×32c): the \’setlocale\’ function supports only C&line;POSIX locales
appptt.elf2flt: In function `open_iconv\’:
appptt.elf2flt(.text+0xa2e0): undefined reference to `iconv_open\’
appptt.elf2flt: In function `native2utf8\’:
appptt.elf2flt(.text+0xa478): undefined reference to `iconv\’
appptt.elf2flt(.text+0xa4a4): undefined reference to `iconv_close\’
appptt.elf2flt: In function `utf2native\’:
appptt.elf2flt(.text+0xa55c): undefined reference to `iconv\’
appptt.elf2flt(.text+0xa588): undefined reference to `iconv_close\’
~~~~~~~~~~
·htonl():把32位值从主机字节序转换成网络字节序
·htons():把16位值从主机字节序转换成网络字节序
·ntohl():把32位值从网络字节序转换成主机字节序
·ntohs():把16位值从网络字节序转换成主机字节序
修改了MAKEFILE文件后没有了
[alert7@redhat]# nasm -f elf tiny.asm
[alert7@redhat]# gcc -Wall -s tiny.o
tiny.o: In function `_start\’:
tiny.o(.text+0×0): multiple definition of `_start\’
/usr/lib/crt1.o(.text+0×0): first defined here
/usr/lib/crt1.o: In function `_start\’:
/usr/lib/crt1.o(.text+0×18): undefined reference to `main\’
collect2: ld returned 1 exit status
如何做才可以编译过去呢?
GCC有一个编译选项–nostartfiles
-nostartfiles
当linking时,不使用标准的启动文件。但是通常是使用的。
修改文件
这里,我们要修改的只有两处,那就是j2me_cldc/kvm/VmUnix/build/Makefile文件。因为我们的KVM是要运行在arm-linux(这里cpu为arm体系结构,操作系统为linux的开发板简称为arm-linux)系统上。所以,KVM必须用arm-linux-gcc编译器编译。我们打开Makefile文件,把
ifeq ($(GCC), true)
CC = gcc
…………
else
处的gcc改成arm-linux-gcc:
ifeq ($(GCC), true)
CC = arm-linux-gcc
…………
Else
第二处就是j2me_cldc/kvm/VmUnix/src/runtime_md.c文件,把这个文件中void InitializeFloatingPoint()函数中的两句注释掉,如:
#if defined(LINUX) && PROCESSOR_ARCHITECTURE_X86
/* Set the precision FPU to double precision */
// fpu_control_t cw = (_FPU_DEFAULT & ~_FPU_EXTENDED) &line; _FPU_DOUBLE;
// _FPU_SETCW(cw);
#endif
这样,就不会出现错误了,但也不支持浮点数了。这里我还不知道如何才能让它支持浮点数,并不出现错误。
这个是移植cldc1.1的:步骤基本相同,我们主要说以下不同的地方:修改完makefile后,make,会出现错误提示:
make: *** [obj/runtime_md.o] Error 1我们向上察看:kvm/VmUnix/src/runtime_md.c: In function `InitializeFloatingPoint’:是在函数InitializeFloatingPoint中出现错误:我们可以采取简单的方法将其注释掉,
void InitializeFloatingPoint() &leftsign;
#if defined(LINUX) && PROCESSOR_ARCHITECTURE_X86
/* Set the precision FPU to double precision */
// fpu_control_t cw = (_FPU_DEFAULT & ~_FPU_EXTENDED) &line; _FPU_DOUBLE;
// _FPU_SETCW(cw);
#endif
&rightsign;当然也也可以修改一下支持flaot,ok保存以下,接着make,就ok了!goodluck!
前两年刚刚参与Linux手机平台的开发时,尝试做了一个KJava的虚拟机,这是其中一个较早的版本,当时只实现了一些核心的功能,使用zlib和sun参考实现中的java api才能工作,可以运行基本的hello world等程序,只限于命令行,不支持UI.
http://blog.chinaunix.net/upfile/070823021750.zip
20070820 uclinux sqlite error
http://www.yippeesoft.com
http://blog.iyi.cn/hily/archives/2006/10/sqlite.html
http://www.potu.com/reader/itempl4672609.html
http://www.sqlite.com.cn/POParticle/6/84.Html
求救:arm-uclibc-gcc编译SQLite的问题
想把SQLite移植到ARM-uClinux上, 按照版上贴的移植方法进行
版本为: sqlite-3.3.17
由于之前多是基于arm-linux-gcc编译的, 将Makefile中有关arm-linux-的地方全换成了arm-uclibc-
maik.mk, os.c, shell等文件也进行了相应修改
但最终没有编译成功! 提示错误:
libsqlite3.a(os_unix.o):in fuction \’sqlite3UnixDlopen\’:
os_unix.o(.text+0xfb4):undefined reference to \’dlopen\’
libsqlite3.a(os_unix.o): In function \’sqlite3UnixDlsym\’:
os_unix.o(. text+0xfc8): undefined reference to \’dlsym\’
libsqlite3.a(os_unix.o): In function \’sqlite3UnixDlclos\’:
os_unix.o(. text+)xfdc): undefined reference to \’dclose\’
collect3: ld returned 1 exit status
make: ***[sqlite3] Error 1
I followed to below order to crosscompile the source but the end I get some undefined reference errors.
Do you have any idea how to solve this problem.
Note: There is no problem when I try to crosscompile ver. 2.8.17. Every thing works great.
**********************
rm tclsqlite.c
PATH=/usr/local/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/bin/:$PATH
for i in *.c; do arm-gcc -O -c $i; done
rm shell.o
ar cr libsqlite.a *.o
ranlib libsqlite.a
arm-gcc -o sqlite shell.c libsqlite.a
libsqlite.a(os_unix.o)(.text+0xf6c): In function `sqlite3UnixDlopen\’:
: undefined reference to `dlopen\’
libsqlite.a(os_unix.o)(.text+0xf78): In function `sqlite3UnixDlsym\’:
: undefined reference to `dlsym\’
libsqlite.a(os_unix.o)(.text+0xf84): In function `sqlite3UnixDlclose\’:
: undefined reference to `dlclose\’
collect2: ld returned 1 exit status
> Jakub Ladman schrieb:
> >> It\’s seems a bit strange to me that Makefile.linux-gcc includes tcl in
> >> the build by default, but it does. Maybe that should change…
> >>
> >> If you add "-DNO_TCL" to the OPTS variable in Makefile.linux-gcc this
> >> error should go away. i.e. add the following line somewhere after the
> >> "OPTS = -DNDEBUG" bit:
> >>
> >> OPTS += -DNO_TCL
Yes, i am idiot!!!!!!
but after correction of this i get:
libsqlite3.a -lpthread
libsqlite3.a(os_unix.o): In function `sqlite3UnixDlopen\’:
os_unix.c:(.text+0×848): undefined reference to `dlopen\’
libsqlite3.a(os_unix.o): In function `sqlite3UnixDlsym\’:
os_unix.c:(.text+0×85c): undefined reference to `dlsym\’
libsqlite3.a(os_unix.o): In function `sqlite3UnixDlclose\’:
os_unix.c:(.text+0×870): undefined reference to `dlclose\’
collect2: ld returned 1 exit status
make: *** [sqlite3] Error 1
[EMAIL PROTECTED] ~/src/sqlite-3.3.13 $
In function `dlfcn_load\’
:dso_dlfcn.c:(.text+0×45): undefined reference to `dlopen\’
:dso_dlfcn.c:(.text+0xc4): undefined reference to `dlclose\’
:dso_dlfcn.c:(.text+0×102): undefined reference to `dlerror\’
解决方法:
在Makefile中的链接参数加上 -ldl就可以解决了
http://www.ccw.com.cn/cio/research/program/htm2004/20041215_110V2.asp
http://www.rzhome.net/blog/article.asp?id=11
http://www.sqlite.org/quickstart.html
http://blog.iyi.cn/hily/archives/2006/10/uclinuxberkeley_db_v4520.html
http://www.ccw.com.cn/cio/research/program/htm2004/20041215_110V2.asp
http://tech.sina.com.cn/other/2004-12-17/0840478378.shtml
http://www.xxlinux.com/linux/article/development/embed/20051201/411.html
http://www.potu.com/reader/itempl4672609.html
标签:cli, err, error, linux, ror, sql, sqlite, uclinux
20070702 嵌入式 Python ERROR
http://www.yippeesoft.com
python for arm的编译没什么特别的
直接用默认的./configurate就可以了
产生的Makefile稍稍做点修改
把里头的gcc、ar、ranlib、c++都加上前缀
例如
gcc –> arm-linux-gcc
ar –> arm-linux-ar
然后执行make就可以鸟
(中途会遇到一个C语言编译错误,是关于宏的,直接删除掉那一段就可以了,然后继续make)
等make完毕就可以得到\’python\’的可执行文件
可以直接拿去跑了
/bin> python
BINFMT_FLAT: bad magic/rev (0×1010161, need 0×4)
BINFMT_FLAT: bad magic/rev (0×1010161, need 0×4)
elf2flt python
python: Input file contains no relocation info
undefined reference to `__DTOR_LIST__\’
./configure CC=arm-linux-gcc –host=arm
checking for %zd printf() format support… configure: error: cannot run test program while cross compiling
~~~~~~~~~~
echo "$as_me:$LINENO: checking for %zd printf() format support" >&5
echo $ECHO_N "checking for %zd printf() format support… $ECHO_C" >&6
if test "$cross_compiling" = yes; then
&leftsign; &leftsign; echo "$as_me:$LINENO: error: cannot run test program while cross compiling
See \\`config.log\’ for more details." >&5
echo "$as_me: error: cannot run test program while cross compiling
See \\`config.log\’ for more details." >&2;&rightsign;
&leftsign; (exit 1); exit 1; &rightsign;; &rightsign;
else
cat >conftest.$ac_ext <<_ACEOF
~~~~~~~~~~~~~~
3, 顶值帖子 “学习使用SkyEye仿真”里编译hello.c时: a
rm-elf-gcc -Wl,-elf2flt -o hello hello.c
我如果加了-Wl参数,编译出来的是hello.gdb,
是一个elf文件,如果去掉-Wl参数,生成的是flt的文件。
在这里,hello.c中的printf()函数是静态链接的吗?
否则怎么能在没有动态链接库的romfs中运行。
为什么在这里-Bstatic参数没有作用?
还有在这里链接时没有指定程序的链接地址,那么arm-elf-tools
默认怎么做的?uClinux下运行时,怎么确定它在哪运行。
~~~~~~~~~~~~~
/usr/local/lib/gcc/arm-linux/3.4.4/../../../../arm-linux/bin/ld.real: error: no memory region specified for loadable section `.plt\’
collect2: ld returned 1 exit status
python: ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.0.0, dynamically linked (uses shared libs), not stripped
/usr/local/arm-elf/bin/ld.real: cannot find -ldl
collect2: ld returned 1 exit status
make: *** [Parser/pgen] Error 1
~~~~~~~~~~~~~~~~
uClinux
uClinux与emDebian至少有两个重要的区别,第一是构建方式,前面已经提到过了,uClinux属于 from scratch 一类的。另一个不同的地方,uClinux是支持不在emDebian支持的11种CPU的,当然,这个说法不是很恰当,正确的说法是uClinux支持那些不具备MMU单元的CPU体系。uClinux的第一个目的是支持MC68328芯片,现在已经能构支持更多的CPU,如Intel i960,ARM等。不过,uClinux的主体开发团队目前已经不再支持ARM了,还好 Samsung 的 Hyok S. Choi 接过了接励棒,Linux 2.6版本的补丁可以在 uClinux/ARM2.6 找到。
uClinux之前仅是核心的一些补丁,后来发展成为一个包括核心、库、应用程序、工具和编译相关的配置文件的一个集成开发环境。与 buildroot不同的是,uClinux不编译目标系统的工具集,也就是说,相应的编译工具应该提前安装好。如,对于arm来说,需要先安装ARM交叉编译器。uClinux的编译器也需要一些补丁,其中比较重要的两个方面主要包括:
用于生成FLT文件的补丁:由于MMU的关系,uClinux不支持ELF可执行文件,这个补丁主要包括bin2flt工具包和一个ld的wrapper脚本等,用于(透明于用户)生成FLT文件;
用于支持XIP(Execute In Place)的补丁:这个补丁需要对gcc进行一些小的修改;支持XIP主要是为了解决小内存环境中运行的问题。
XIP不一定适用于每种应用环境,对于内在要求特别严格的系统来说(空间第一位,如手机要求使用片内RAM),可以通过将核心和应用程序编译为XIP支持,然后直接在Flash上运行,内存仅用于运行时数据;而对于性能要求为主的系统(如高速网络处理器),则不能因为节省一点空间而使用XIP将程序直接在Flash上运行,这样可能会降低指令的读取速度而影响系统性能(但仍然可以使用XIP,使程序的多个实例在内存中共享代码空间,以后详细说); + FLT可执行文件支持动态链接库(目前仅m68k支持,参见 uCdot: Shared libraries under uClinux mini-HOWTO)的补丁;
uClinux的编译过程大致是,首先,通过可视配置界面(menuconfig/xconfig)选取Vendor和board(实际上是选择了一些配置文件和产品相关的文件),然后根据选择构造一个适用于target的开发环境,如生成头文件和需要的库文件(uClibc、glibc或uC-libc 以及其它一些库),然后编译核心、库、应用程序,最后将所有的输出安装到romfs目录中,根据需要生成目标平台需要的映像文件(如: romfs.img、linux.bin、rootfs.gz等)。
由于一些过程细节被隐藏起来,uClinux现在的编译过程方便到只需要配置一下(make menuconfig),然后 make 就可以直接获得最终输出。不过这反倒成为一些初学者学习的一个麻烦,本文完成后,根据对本文的反馈,将进一步对uClinux进行详细介绍。
总的来说,目前的uClinux是一套主要用于无MMU核(但不限于此)的嵌入式Linux集成环境,也是一个非常好的 Linux from scratch 的示例。抛开其MMU相关的补丁,uClinux也可以作为一套用于包含MMU系统的集成开发环境,Snapgear 就是一个很好的例子。实际上,我们可以从官方的uClinux源码就可以直接编译一个支运行于X86的uClinux。
~~~~~~~~~~~~~
据说:
arm-linux-gcc为有MMU的LINUX准备的比如LPC2410上的LINUX
arm-elf-gcc为没有MMU的UCLINUX准备的比如LPC2100上的UCLINUX
我用的是Uclinux 所以不能用arm-linux-gcc吧?
~~~~~~~~~~~~~~~~~~
BINFMT_FLAT: reloc outside program 0×11800 (0 – 0×7064/0×5d80), killing hello!
BINFMT_FLAT: reloc outside program 0×11800 (0 – 0×7064/0×5d80), killing hello!
这种错误一般是内存分配的问题,很可能就是内存不够用了。
~~~~~~~~~~~~~
在FS44B0xII板子上运行自己的程序,就是执行不了,不知什么原因。我的操作如下:
1.按照你们提供的使用手册(以及相关的代码)将uclinux弄到板子上去了,uclinux可以运行。
2.在linux下写了一个最简单的"hello,world"的程序,文件名为"hello.c"
/**hello.c**/
#include<stdio.h>
int main()
&leftsign;
printf("hello,world!\\n");
return 0;
&rightsign;
3.安装好arm-elf-gcc编译工具,用如下方法编译
#arm-elf-gcc -o hello hello.c -elf2flt
生成hello的执行文件
4.用超级终端启动板子上的uclinux,执行
#mount -t ramfs ramfs /mnt
挂载ramfs于mnt目录下,这样mnt目录下就可以读写了
5.在mnt目录下通过ftp 下载 pc机上编译生成的hello文件,并用chmod改变权限,执行
#chmod 777 hello
#./hello
出现下面的错误:
BINFMT_FLAT: reloc outside program 0×11800 (0 – 0×7064/0×5d80), killing hello!
BINFMT_FLAT: reloc outside program 0×11800 (0 – 0×7064/0×5d80), killing hello!
Memory fault
不知道这是什么原因引起的,希望能够给予解答,谢谢!
同时,我又用arm-linux-gcc 来编译我这个hello.c文件
然后通过同样的方法下载到板子的/mnt目录下,然后执行,又报出下面的错误:
BINFMT_FLAT: bad magic/rev (0×1010161, need 0×4)
BINFMT_FLAT: bad magic/rev (0×1010161, need 0×4)
hello2: applet not found
~~~~~~~~~~~~~~~
Yes, there are some differences between arm-elf, arm-linux, and
arm-uclinux toolchains.
As I know, arm-uclinux-binutils is the same as arm-linux-binutils.
arm-uclinux-gcc was patched from arm-linux-gcc to generate PIC
(Program Independent Code) code without GOT (Global Offset Table);
and arm-elf-gcc is designed for operating system independent
applications. For example, arm-elf-gcc will insert code for initializing
global C++ constructors at the beginning of main(), so even no-OS
platforms can work properly. BTW, they are almost the same while
compiling the Linux kernel.
~~~~~~~~~~~~~
No, it depends on the version of elf2flt.
The arm-uclinux-gcc is required while using old elf2flt tool.
Modern el2flt programs do not use PIC, so all three toolchains
can be used in developing userland applications.
~~~~~~~~~~~~~
使用arm-linux-gcc编译器能编译应用程序吗?
不能,编译应用程序请使用arm-elf-gcc编译器,并使用-Wl,-elf2flt连接参数生成flat格式文件。
~~~~~~~~~
arm-elf-ld -L/usr/local/uClibc -elf2flt -o hello
/usr/local/uClibc/lib/crt0.o crtbegin.o hello.o crtend.o –lc –lgcc
-lc
可以完全实现,snmpd就由此完成,以前我用 -Wl,-elf2flt=-z不行的,记住加上lgcc
有一种可能是系统里安装两个交叉编译的编译器如arm-elf-gcc,arm-linux-gcc之类的。两者都安装在/usr/local中,有可能其中一个在安装时覆盖了另一个编译器所需的文件,导致再编译时产生混乱。彻底删除(编译器和相应的库都删了才行)其中一个应该就OK了吧。
其实不然,最安全的做法是在Makefile中加入完整路径,如果你使用Redhat Linux,建议你在自己的$HOME/.bash_profile中加入路径,文件可以在任何位置,这样不会影响其它环境变量.实际上这两种编译器的路径是不同的,并不会产生冲突,真正的冲突在于系统寻找arm-elf-gcc或arm-linux-gcc的路径先后顺序.一般来说.在/bin:/sbin/usr/bin:/usr/sbin中的执行文件最快被引用./usr/local/bin: /usr/local/sbin等也可被检测,还可以用export PATH=/xxx/uuy/bi等,但编译时系统寻找的不是一定恰好是你想要的编译器.如使用2.95.3和3.0以上的是不同的.有些在低版中是通不过的,还有与你的计算机有关,如果用i386可能很好,但如果用P IV或指定Build HOST的ARCH,编译出来的结果会有差异的.甚至SIZE都不一样.有时我们发现,在新的PC中,编译过的代码在目标机上运行不起来.
直接用arm-elf-ld和arm-elf-gcc当然是不同的
蓝牙楼主用arm-elf-gcc驱动ld,缺省已经做了-lc -lgcc和
crt0.o连接的工作.
所以gcc hello.c这样简单命令就能成功编译a.out
至于arm-elf-gcc的情况加上-elf2flt,ok.
我用arm-elf-gcc -Wl,-elf2flt 编译文件,结果是放在uClinux上无法执行.出现了:
BINFMT_FLAT: bad magic/rev (0×0, need 0×4)
BINFMT_FLAT: bad magic/rev (0×0, need 0×4)
这是为什么?
uClinux使用这种格式的可执行文件格式真害人(b.out),arm-linux-gcc就可以.不是elf格式.而且没法strip, 直接用-elf2flt编译,生成的好像是strip了的.但大的系统就麻烦了.uClibc的运行库本身还是arm-elf格式的.
BINFMT_FLAT: reloc outside program 0×240d000c (0 – 0xfff83c94/0xc06a0), killing
snmpd!
BINFMT_FLAT: reloc outside program 0×240d000c (0 – 0xfff83c94/0xc06a0), killing
snmpd!
pid 79: failed 11
现在这种问题怎么解决,应当是由于uClinux中不带MMU管理的原因.重定位时,内存地址超界,但怎么办呢?
BINFMT_FLAT的问题是产生的文件不是
正确的FLAT格式.似乎没有正确调用elf2flt.
bad magic/rev没有产生出标准的magic number"bFLT 4"
reloc 的值也不对.
另外,flat格式没有symbol table,不需要strip
六、应用程序开发 -- ApplicationsLUPA开源社区&ADXW!w1Ael
1.arm-elf-gcc main.c -elf2flt
arm-linux-gcc main.c
~~~~~~~~~~~~~~
我也正在编译blob,遇到的编译问题是一样的。这里说说的我的做法(使用环境RedHat 9):
1. 编辑文件 configure ,把所有arm-linux 改为arm-elf; 在580行处(“ac_ext=c”之前)插入 LDFLAGS=-elf2flt ,保存文件。
2.运行命令./configure –with-board=mba-44b0 –with-linux-prefix=/usr/local/src/uClinux-dist/linux-2.4.x (这是我的uclinux目录) –host=arm-elf
结果:LDFLAGS = -elf2flt -static -nostdlib
3.运行make
4.编译到arm-elf-objcopy -O binary -R .note .comment -S blob-start-elf32 blob-start出现错误(与你的一样):
arm-elf-objcopy:blob-start-elf32:File format not recognized
5.分析blob-start-elf32编译的命令
arm-elf-gcc -Os -I/usr/local/src/uClinux-dist/linux-2.4.x/include
-Wall -march=armv4 -mtune=strongarm1100
-fomit-frame-pointer -fno-builtin -mapcs-32 -nostdinc
-elf2flt -static -nostdlib -o blob-start-elf32
-Wl,-T,./start-ld-script start.o ledasm.o memsetup-s3c44b0.o -lgcc
使用了-elf2flt 选项,把blob-start-elf32编译成flat格式。
6.到目录 blob/src/blob目录下直接执行编译命令(把-elf2flt去掉)
arm-elf-gcc -Os -I/usr/local/src/uClinux-dist/linux-2.4.x/include
-Wall -march=armv4 -mtune=strongarm1100
-fomit-frame-ointer -fno-builtin -mapcs-32 -nostdinc
-static -nostdlib -o blob-start-elf32
-Wl,-T,./start-ld-script start.o ledasm.o memsetup-s3c44b0.o -lgcc
再执行一次
arm-elf-objcopy -O binary -R .note .comment -S blob-start-elf32 blob-start
结果顺利编译通过
显然 arm-elf-objcopy 中 blob-start-elf32 必须为elf格式
其后的blob-rest-elf32 ,blob-chain-elf32编译也应该是elf格式。
7.结论:所以编译源文件要使用 -elf2flt 才能编译通过,但编译连接 blob-start-elf32 又不能使用-elf2flt开关
~~~~~~~~~~
The kernel is reporting that the file you\’re running isn\’t a valid executable file format. For all Nios II Linux systems, each executable must be in a flat binary format. This usually entails running elf2flt on any applications that you build.
If you\’d like I can take a look at the Makefile you\’re using and try to figure out what\’s going on. If so, please pm me or post it here in the forum.
~~~~~~~~~~~~~~~
What causes \’BINFMT_FLAT: bad magic/rev (0xZZ, need 0xYY)\’ errors
FAQ A lot of people encounter this error the first time they try to run a program on a uClinux system. Usually this is caused by trying to run an ELF or COFF executable rather than a "flat" executable. uClinux does not support anything but the "flat" executable format. ELF/COFF programs are converted to "flat" format using elf2flt/coff2flt respectively.
To fix this problem with the ELF toolchain add -Wl,-elf2flt to the final link line of your build and it will create a flat executable. For the COFF toolchain there is some excellent feedback by jeff included in the followup comments to this story.
~~~~~~~~~~~~
我把编译后在microwindows/src/bin生成的一些可执行文件放到romfs中(如demo,demo1),
用genromfs打包后倒入到开发板上,运行该文件,出现:
BINFMT_FLAT:bad magic/rev (0×1010161,need 0×4)
BINFMT_FLAT:bad magic/rev (0×1010161,need 0×4)
./demo: Exec format error
我想可能是编译器的问题,产生的文件格式不是FLAT的,是不是不能用arm-linux-gcc而要改成
arm-elf-gcc,所以在make xconfig时把编译器改成arm-elf-gcc,但编译出错:
Compiling srvnet.c …
Linking /root/uclinux/microwindows-0.90/src/bin/nano-X …
collect2: ld terminated with signal 11 [Segmentation fault],core dumped
make[1]:*** [/root/uclinux/microwindows-0.90/src/bin/nano-X] Error 1
make: *** [subdir-nanox] Error 2
~~~~~~~
Hi ,everyone:
Who can tell me the difference between elf,coff,flt file format?
I used arm-linux-cross.tar.bz2 compiled my uClinux-2.4.x and busybox0.60.5,generate coff file,I load the generated file to my EVM board,kernel can run success,but busybox can not run,the result of running is:
/dev/console initialized successfully.
BINFMT_FLAT: bad magic/rev (0×1010161, need 0×4)
BINFMT_FLAT: bad magic/rev (0×1010161, need 0×4)
BINFMT_FLAT: bad magic/rev (0×1010161, need 0×4)
BINFMT_FLAT: bad magic/rev (0×1010161, need 0×4)
Kernel panic: No init found. Try passing init= option to kernel.
I suspect that busybox is not in flat format, I can not confirm that arm-linux-cross toolchain has not elf2flt function.I use arm-linux-cross.tar.bz2 toolchain compile elf2flt-20020731.tar.gz,failed,prompt as following:
/data/lart/cross/bin/arm-linux-gcc -g -O2 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=1 -DHAVE_UNISTD_H=1 -DHAVE_BFD_H=1 -DHAVE_VPRINTF=1 -DTARGET_arm -I/data/lart/cross/arm-linux/include -static -o elf2flt ./elf2flt.c /data/lart/cross/lib/libbfd.a /data/lart/cross/lib/libiberty.a
collect2: ld terminated with signal 11 [Segmentation fault], core dumped
make: *** [elf2flt] Error 1
~~~~~~~~~~~~~
而我要用在的ARM9上(ARM7也一样,都是flat的文件格式,库文件也是),我所用的交叉编译工具是arm-linux-gcc, 版本3.3.2.我首先在db-4.5.20下新建了一个build_arm_linux目录,然后编译,命令如下:
mkdir build_arm_linux
cd build_arm_linux
../dist/configure CC=arm-linux-gcc –host=arm
make
~~~~~~~~~~~~~~~
标签:err, error, python, ror, 嵌入式20070703 嵌入式 Python cross compile err
http://www.yippeesoft.com
~
UCLINUX自带的
./configure make
结果:
printgrammar.c:112: undefined reference to `fwrite\’
~~
下载最新的:
直接编译 PASS
[root@mobile Python-2.5.1]# ./python
Python 2.5.1 (r251:54863, Jul 2 2007, 16:19:59)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
~~~~~~~~~
./configure –target=arm-linux
[root@mobile Python-2.5.1]# file python
python: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), not stripped
/bin> python
BINFMT_FLAT: bad magic/rev (0×1010100, need 0×4)
BINFMT_FLAT: bad magic/rev (0×1010100, need 0×4)
Shell invoked to run file: /bin/python
What causes \’BINFMT_FLAT: bad magic/rev (0xZZ, need 0xYY)\’ errors
FAQ A lot of people encounter this error the first time they try to run a program on a uClinux system. Usually this is caused by trying to run an ELF or COFF executable rather than a "flat" executable. uClinux does not support anything but the "flat" executable format. ELF/COFF programs are converted to "flat" format using elf2flt/coff2flt respectively.
To fix this problem with the ELF toolchain add -Wl,-elf2flt to the final link line of your build and it will create a flat executable. For the COFF toolchain there is some excellent feedback by jeff included in the followup comments to this story.
执行
[root@mobile Python-2.5.1]# elf2flt ./python
./python: Input file contains no relocation info
~~~~~~~~~
./configure –host=arm-linux
checking for %zd printf() format support… configure: error: cannot run test program while cross compiling
See `config.log\’ for more details.
~~~~~~~~~~~~
./configure CC=arm-linux-gcc –host=arm
checking for %zd printf() format support… configure: error: cannot run test program while cross compiling
~~~~~~~~~~
http://netwinder.osuosl.org/users/c/craign/mp3/
这里有splay_fp版本的。
madplay也可以播放的,libmad是定点运算的。播放很流畅。
如果采用madplay,需要libmad, libid3tag, zlib等。
我给出我的configure
1.
编译zlib 因为libid3tag需要这个库
./configure –prefix=/usr/local/arm/2.95.3/arm-linux
修改Makefile
AR=/usr/local/arm/2.95.3/bin/arm-linux-ar
CC=/usr/local/arm/2.95.3/bin/arm-linux-gcc
RANLIB=/usr/local/arm/2.95.3/bin/arm-linux-ranlib
最后AR 命令要添加rcs,否则出错
make
make install
2.
编译libid3tag
./configure –host=arm-linux CC=arm-linux-gcc –disable-debugging –disable-shared –prefix=/usr/local/arm/2.95.3/arm-linux
make
make install
3.
编译libmad
./configure –enable-fpm=arm –host=arm-linux –disable-shared –disable-debugging –prefix=/usr/local/arm/2.95.3/arm-linux CC=arm-linux-gcc
make
make install
4.
编译madplay
./configure –host=arm-linux CC=arm-linux-gcc –disable-debugging –disable-shared
make
但是,这样得到的是动态连接的。
rm madplay
拷贝make的最后一个连接的命令,在最后加上-static,然后运行,得到静态连接的程序
OK
主题:为什么我用arm-linux-gcc生成的文件在目标板上无法执行
所属分类:Linux/Unix社区 内核及驱动程序研究区
———————————————————————-
为什么我用arm-linux-gcc生成的文件在目标板上无法执行,而arm-elf-gcc -Wl,-elf2flt生成的文件
就可以执行。是不是和操作系统有关,我的操作系统是uclinux
———————————————————————-
http://www.linuxfans.org/nuke/modules.php?name=Forums&file=viewtopic&t=55934&start=15
我也正在编译blob,遇到的编译问题是一样的。这里说说的我的做法(使用环境RedHat 9):
1. 编辑文件 configure ,把所有arm-linux 改为arm-elf; 在580行处(“ac_ext=c”之前)插入 LDFLAGS=-elf2flt ,保存文件。
2.运行命令./configure –with-board=mba-44b0 –with-linux-prefix= /usr/local/src/uClinux-dist/linux-2.4.x (这是我的uclinux目录) –host=arm-elf
结果:LDFLAGS = -elf2flt -static -nostdlib
3.运行make
4.编译到arm-elf-objcopy -O binary -R .note .comment -S blob-start-elf32 blob-start出现错误(与你的一样):
arm-elf-objcopy:blob-start-elf32:File format not recognized
5.分析blob-start-elf32编译的命令
arm-elf-gcc -Os -I/usr/local/src/uClinux-dist/linux-2.4.x/include
-Wall -march=armv4 -mtune=strongarm1100
-fomit-frame-pointer -fno-builtin -mapcs-32 -nostdinc
-elf2flt -static -nostdlib -o blob-start-elf32
-Wl,-T,./start-ld-script start.o ledasm.o memsetup-s3c44b0.o -lgcc
使用了-elf2flt 选项,把blob-start-elf32编译成flat格式。
6.到目录 blob/src/blob目录下直接执行编译命令(把-elf2flt去掉)
arm-elf-gcc -Os -I/usr/local/src/uClinux-dist/linux-2.4.x/include
-Wall -march=armv4 -mtune=strongarm1100
-fomit-frame-ointer -fno-builtin -mapcs-32 -nostdinc
-static -nostdlib -o blob-start-elf32
-Wl,-T,./start-ld-script start.o ledasm.o memsetup-s3c44b0.o -lgcc
再执行一次
arm-elf-objcopy -O binary -R .note .comment -S blob-start-elf32 blob-start
结果顺利编译通过
显然 arm-elf-objcopy 中 blob-start-elf32 必须为elf格式
其后的blob-rest-elf32 ,blob-chain-elf32编译也应该是elf格式。
7.结论:所以编译源文件要使用 -elf2flt 才能编译通过,但编译连接 blob-start-elf32 又不能使用-elf2flt开关
8.直接修改blob/src/blob的Makefile ,但运行make 后,此Makefile又回复原样,实在没有办法,不知道如何修改。
9.本人一直在windows下编写程序,对makefile 的编辑不是很熟悉,虽然知道错误的原因, 但不知怎样修改makefile ,此事很急,请各位大侠赐教!
问题终于解决了!换个编译器,到http://www.lomx.net/cn/lom_arm9_tooltrain.htm
下载一个编译器吧
20070605 vs2005 cstring error C2679
http://www.yippeesoft.com
缺少UNICODE编码经验
Concatenating Two CString Objects
To concatenate two CString objects, use the concatenation operators (+ or +=) as follows:
Copy Code
CString s1 = "This "; // Cascading concatenation
s1 += "is a ";
CString s2 = "test";
CString message = s1 + "big " + s2;
// Message contains "This is a big test".
At least one argument to the concatenation operators (+ or +=) must be a CString object, but you can use a constant character string (such as "big") or a char (such as \’x\’) for the other argument.
改为 CString message = s1 + L"big " + s2;
rror C2678: binary \’+\’ : no operator found which takes a left-hand operand of type \’const char [2]\’ (or there is no acceptable conversion)
2> O:\\ms\\vs8\\VC\\ce\\atlmfc\\include\\atlsimpstr.h(667): could be \’ATL::CSimpleStringT<BaseType> ATL::CSimpleStringT<BaseType>::operator +(const ATL::CSimpleStringT<BaseType> &,const ATL::CSimpleStringT<BaseType> &)\’ [found using argument-dependent lookup]
2> with
2> [
2> BaseType=TCHAR
2> ]
2> O:\\ms\\vs8\\VC\\ce\\atlmfc\\include\\atlsimpstr.h(678): or \’ATL::CSimpleStringT<BaseType> ATL::CSimpleStringT<BaseType>::operator +(const ATL::CSimpleStringT<BaseType> &,const wchar_t *)\’ [found using argument-dependent lookup]
2> with
2> [
2> BaseType=TCHAR
2> ]
2> O:\\ms\\vs8\\VC\\ce\\atlmfc\\include\\atlsimpstr.h(689): or \’ATL::CSimpleStringT<BaseType> ATL::CSimpleStringT<BaseType>::operator +(const wchar_t *,const ATL::CSimpleStringT<BaseType> &)\’ [found using argument-dependent lookup]
2> with
2> [
2> BaseType=TCHAR
2> ]
2> O:\\ms\\vs8\\VC\\ce\\atlmfc\\include\\cstringt.h(2316): or \’ATL::CStringT<BaseType,StringTraits> ATL::CStringT<BaseType,StringTraits>::operator +(const ATL::CStringT<BaseType,StringTraits> &,const ATL::CStringT<BaseType,StringTraits> &)\’ [found using argument-dependent lookup]
2> with
2> [
2> BaseType=wchar_t,
2> StringTraits=StrTraitMFC<wchar_t>
2> ]
2> O:\\ms\\vs8\\VC\\ce\\atlmfc\\include\\cstringt.h(2325): or \’ATL::CStringT<BaseType,StringTraits> ATL::CStringT<BaseType,StringTraits>::operator +(const ATL::CStringT<BaseType,StringTraits> &,const wchar_t *)\’ [found using argument-dependent lookup]
2> with
2> [
2> BaseType=wchar_t,
2> StringTraits=StrTraitMFC<wchar_t>
2> ]
2> O:\\ms\\vs8\\VC\\ce\\atlmfc\\include\\cstringt.h(2334): or \’ATL::CStringT<BaseType,StringTraits> ATL::CStringT<BaseType,StringTraits>::operator +(const wchar_t *,const ATL::CStringT<BaseType,StringTraits> &)\’ [found using argument-dependent lookup]
2> with
2> [
2> BaseType=wchar_t,
2> StringTraits=StrTraitMFC<wchar_t>
2> ]
2> O:\\ms\\vs8\\VC\\ce\\atlmfc\\include\\cstringt.h(2343): or \’ATL::CStringT<BaseType,StringTraits> ATL::CStringT<BaseType,StringTraits>::operator +(const ATL::CStringT<BaseType,StringTraits> &,wchar_t)\’ [found using argument-dependent lookup]
2> with
2> [
2> BaseType=wchar_t,
2> StringTraits=StrTraitMFC<wchar_t>
2> ]
2> O:\\ms\\vs8\\VC\\ce\\atlmfc\\include\\cstringt.h(2353): or \’ATL::CStringT<BaseType,StringTraits> ATL::CStringT<BaseType,StringTraits>::operator +(const ATL::CStringT<BaseType,StringTraits> &,char)\’ [found using argument-dependent lookup]
2> with
2> [
2> BaseType=wchar_t,
2> StringTraits=StrTraitMFC<wchar_t>
2> ]
2> O:\\ms\\vs8\\VC\\ce\\atlmfc\\include\\cstringt.h(2363): or \’ATL::CStringT<BaseType,StringTraits> ATL::CStringT<BaseType,StringTraits>::operator +(wchar_t,const ATL::CStringT<BaseType,StringTraits> &)\’ [found using argument-dependent lookup]
2> with
2> [
2> BaseType=wchar_t,
2> StringTraits=StrTraitMFC<wchar_t>
2> ]
2> O:\\ms\\vs8\\VC\\ce\\atlmfc\\include\\cstringt.h(2373): or \’ATL::CStringT<BaseType,StringTraits> ATL::CStringT<BaseType,StringTraits>::operator +(char,const ATL::CStringT<BaseType,StringTraits> &)\’ [found using argument-dependent lookup]
2> with
2> [
2> BaseType=wchar_t,
2> StringTraits=StrTraitMFC<wchar_t>
2> ]
2> while trying to match the argument list \’(const char [2], CString)\’
20070718 vs2003 安装 SETUP INSTALL 25003 error
http://www.yippeesoft.com
以前安装OK,今天居然失败。
发现原因
以前用DTOOLS虚拟光驱,可以共享
现在用VCdControlTool.exe 居然不能共享
因此把ISO解压了,结果没有映射
微软的程序经常这样,没有在根目录下就有问题
安装VS.net 2003时发生错误(ERROR: 内部错误 2337)的解决方法
在困惑了两天两夜,使用google搜索了所有能搜到的相关错误信息的网页,始终未果。
把XP所有的补丁打了几遍,把XP重装两遍,俄版的,大上海版的。
又装了windows server 2003,还是报如下错误:
[03/19/04,13:42:05] Visual Studio .NET Enterprise Architect 2003 – CHS: [2] ERROR: 内部错误 2337。
[03/19/04,13:45:13] Visual Studio .NET Enterprise Architect 2003 – CHS: [2] ERROR processed; exception was thrown for retail build
Developer Comment: 操作启动消息顺序不对
Build Time: Thu Feb 15 17:56:18 2001
HRESULT: -2147467259
[03/19/04,13:46:01] setup.exe: [2] ISetupComponent::Pre/Post/Install() failed in ISetupManager::InstallManagerHelper()
[03/19/04,13:46:01] setup.exe: [2] Component error string not specified in ISetupManager::AddToActionResultCollection()
高分求救:XP下安装VS2003出错(正在执行操作:CreateVSDevGroup 内部错误 25003。)
XP下安装VS2003,第一项准备已经装好,但装VS时出错。我开始以为是XP系统不好,重新装了一次XP,刚装好的新系统就开始装VS,还有分别重装了三次不同的虚拟光驱软件,最后还都是出一样的错误:
正在执行操作:CreateVSDevGroup
内部错误 25003。
到底是什么问题啊?是操作系统还是VS软件?这个VS2003我同学在WIN2003下装过,没问题。
错误日志:
[01/28/05,12:11:51] Visual Studio .NET Enterprise Architect 2003 – CHS: [2] ERROR: 内部错误 25003。
[01/28/05,12:11:54] Visual Studio .NET Enterprise Architect 2003 – CHS: [2] ERROR: 内部错误 25003。
[01/28/05,12:12:07] setup.exe: [2] ISetupComponent::Pre/Post/Install() failed in ISetupManager::InstallManagerHelper()
[01/28/05,12:12:07] setup.exe: [2] Component error string not specified in ISetupManager::AddToActionResultCollection()
have WinXP & brand new HP PC.
I have the MSDN Uinviseral Subscription
So I downloaed the DVD full install eng ed
of VS 2003.NET Enterprise Edition.
I followed all the setup instrucitons about
seting up IIS on XP and FP ext. etc.
I did a Windows Update. (but skipped XP sp2)
I got the Prereqs installed.
Then went on to step 2 in VS install
I selected a diffrent drive (becuase my system drive only
has 10 GB free and I dont want to fill that up)
I selected all the check boxes so none are grey to get
a "Full Install".
The install starts but about 3 minutes in I get "Internal
Error 25003" popup
window.
As you can see below, my vsinstall71.txt
shows "failed to find global prop in
CUIMgr::GetGlobalProperty()"
I found no help on the web or microsoft.com
on this error.
OK I tried using the dos command subst to create a V:
drive to start where the setup.exe is.
subst V: F:\\apps\\VSENARD1
And as I run that command, the auto start runs setup.
安装 MicrosoftVisualStudio.NET, 时出现 " 安装 Error 25003 " 错误信息。 如果文件不正确复制安装过程中可能会发生此问题。
有关如何解决安装错误 25003 提示
下面是各种方法来解决此问题:• 请确保已与使用 (如 CD-ROM) 安装媒体未损坏。
有关其他信息, 请单击下列文章编号以查看 Microsoft 知识库中相应:
284230 (http://support.microsoft.com/kb/284230/) INFO: 替换损坏或有缺陷 VisualStudio 产品磁盘
• 确保不出现任何问题 (如防病毒程序) 上安装的其他程序。 如果是 VisualStudio.NET 安装程序时运行防病毒程序或运行 Microsoft.NET 框架安装, 安装可能失败。
有关其他信息, 请单击下列文章编号以查看 Microsoft 知识库中相应:
330733 (http://support.microsoft.com/kb/330733/) PRB: 当病毒 Visual Studio NET 2003 安装程序可能失败或防火墙程序正在运行
• 如果从 CD-ROM, 安装 VisualStudio.NET 将的 CD-ROM 内容复制到硬盘, 然后从硬盘启动安装。
• 如果您有多个 CD-ROM 驱动器, 尝试从不同 CD-ROM 驱动器启动的 VisualStudio.NET 安装。
• 确保可以从安装 CD-ROM, CD-ROM 驱动器正确读取数据。
• 如果您尝试从共享 CD-ROM 驱动器运行到其它计算机, 安装通过网络安装可能失败。 将安装文件复制到硬盘, 然后从硬盘运行安装程序通过网络。
为网络安装创建 .ini 文件
必须根据要安装的 Visual Studio .NET 功能为网络安装创建一个 .ini 文件。安装程序使用此 .ini 文件在网络计算机上安装 Visual Studio .NET。要为网络安装创建 .ini 文件,请按照下列步骤操作: 1. 插入 Visual Studio .NET CD 1 或 DVD,并忽略自动运行消息。
2. 单击“开始”,然后单击“运行”。
3. 键入下面的命令,然后单击“确定”。
N:\\setup\\Setup.exe /createunattend PathToIniFile
例如:
D:\\setup\\Setup.exe /createunattend c:\\vs7_deployment.ini
4. 在“Microsoft Visual Studio .NET 管理员模式”对话框中,单击“接受协议”以接受《最终用户许可协议》,在“产品密钥”框中键入 25 位的产品密钥,然后单击“继续”。
注意:产品密钥在 CD 包装上。
5. 在 Select items to install(选择要安装的项)下,选择要在网络计算机上安装的项,然后单击“保存设置”。
6. 保存 .ini 文件后,单击“完成”。
20070711 WEB SERVICE 代理类 proxy wsdl error CS0234
http://www.yippeesoft.com
Web Service体系结构包含了三个角色:服务提供者(Service provider)、服务代理者(Service broker)和服务请求者(Service request)。服务提供者提供可通过网络访问的软件模块(Web 服务的一个商业处理功能),并通过 WSDL描述服务中所含的功能、要使用此功能所需输入的数据,以及预期的输出结果。服务提供者把它发布到服务代理者。服务代理者的核心是UDDI数据库,它允许服务提供者公告服务内容并使服务请求者能找到这些服务。服务请求者使用查找操作来从本地或服务代理者处检索服务描述,然后使用服务描述与服务提供者进行绑定并调用Web Service 功能。
Web服务代理是支持.net的编程语言文件,由.net框架提供的WSDL工具自动生成。代理类不包含任何应用程序逻辑。相反,他包含关于如何传递参数和检索结果的传输逻辑,还包含Web服务中的方法及原型列表。代理类可以从任何WSDL文件创建。
可以像访问com对象一样访问Web服务。要访问Web服务,需要从本地计算机上的Web服务的WSDL文档创建代理类。.net提供了名为WSDL.exe的工具以自动生成代理类文件。下面详细说明其创建和使用过程:
一个WEB SERVICE,原来使用呢自己做的工具生成DLL文件,好像使用呢System.CodeDom 命名空间包含可以用于表示源代码文档的元素和结构的类。此命名空间中的类可用来建立源代码文档结构的模型,使用 System.CodeDom.Compiler 命名空间提供的功能可以将源代码文档输出为所支持语言的源代码。
根据网上的说法
call "O:\\ms\\VS7\\Common7\\Tools\\vsvars32.bat"
wsdl http://localhostsf.WebService/Ordersf.asmx /n:sf.method
csc /out:Bridge_sf.dll /t:library /r:System.Web.Services.dll sf.cs
生成呢CS文件,也看到了,可就是编译不能通过,报告
error CS0246: 找不到类型或命名空间名称“add”(是否缺少 using 指令或程序集引用?)
郁闷,使用对象浏览器也看不到几个方法
对方给你的url只要能返回一份wsdl文档就可以了,asmx那些后缀只是不同的服务实现而已。
有了这个url,最简单的做法是通过studio.net的添加web引用-输入url,如果url正确的话则studio直接会生成相关的代理类,然后在程序中直接引用就可以了。
资料:
1、 新建一个asp应用程序(#C)工程,工程名为TeachShow,在TeachShow工程中创建一个文件夹Charpter8,在该文件夹下创建一个新的Web服务,取名为:Computer.asmx
2、 切换到代码视图,编写下面的代码:
[WebMethod(Description="用于相加运算", EnableSession=false)]
public int Add(int a,int b)
&leftsign;
return a+b;
&rightsign;
3、按F5编译整个工程(这一步一定要做,如果不做第4步无法实现)
4、打开MS.net 2003的命令提示工具,输入:C:\\>wsdl http://localhost/TeachShow/Charpter8/FirstAndUse/Computer.asmx /n:ComputerNameSpace,其中,ComputerNameSpace是自定义的命名空间。提示如下:
Microsoft (R) Web 服务描述语言实用工具
[Microsoft (R) .NET Framework,版本 1.1.4322.573]
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
正在写入文件“C:\\Computer.cs”。
5、注意,此时在C:盘(其实就是命令提示符的当前目录)下生成一个和Computer.asmx相同文件名的C#源文件Computer.cs。
6、编译Computer.cs文件,在命令提示符下输入如下命令:C:\\>csc /out:ComputerDll.dll /t:library /r:System.Web.Services.dll c:\\Computer.cs。其中,/out:ComputerDll.dll是要输出的dll文件,/t:library是输出文件类型,/r:System.Web.Services.dll是要引用的组件,c:\\Computer.cs是第4步生成的C#文件。
7、此时,将会在C:盘下生成一个叫ComputerDll.dll的文件,要使用这个文件,必须复制到TeachShow文件夹下的bin目录下。默认情况下为:C:\\Inetpub\\wwwroot\\TeachShow\\bin。
8、新建一个名为TestWSDL.aspx的WEB窗体文件,并添加一个引用,将刚才生成的ComputerDll.dll文件作为引用添加到工程中。
9、在TestWSDL.aspx窗体的Load事件中编写代码:
ComputerNameSpace.Computer com=new ComputerNameSpace.Computer();
this.Response.Write("和:"+com.Add(45,65).ToString()+"");
动态调用Web Service
//其实就是先获得Web Service的WSDL,然后生产代理类,把代理类加入到CodeDOM中建立源码,然后执行创建CSharp(或其他)编译器编译执行。
/// <summary>
/// 根据指定的信息,调用远程WebService方法
/// </summary>
/// <param name=url>WebService的http形式的地址</param>
/// <param name=namespace>欲调用的WebService的命名空间</param>
/// <param name=classname>欲调用的WebService的类名(不包括命名空间前缀)</param>
/// <param name=methodname>欲调用的WebService的方法名</param>
/// <param name=args>参数列表</param>
/// <returns>WebService的执行结果</returns>
/// <remarks>
/// 如果调用失败,将会抛出Exception。请调用的时候,适当截获异常。
/// 异常信息可能会发生在两个地方:
/// 1、动态构造WebService的时候,CompileAssembly失败。
/// 2、WebService本身执行失败。
/// </remarks>
/// <example>
/// <code>
/// object obj = InvokeWebservice(http://localhost/GSP_WorkflowWebservice/common.asmx,Genersoft.Platform.Service.Workflow,Common,GetToolType,new object[]&leftsign;1&rightsign;);
/// </code>
/// </example>
public static object InvokeWebservice(string url, string @namespace, string classname, string methodname, object[] args)
&leftsign;
try
&leftsign;
//提供向 URI 标识的资源发送数据和从 URI 标识的资源接收数据的公共方法。不能继承此类。
System.Net.WebClient wc = new System.Net.WebClient();
//为从具有指定 URI 的资源下载的数据打开一个可读的流。
System.IO.Stream stream = wc.OpenRead(url+"?WSDL");
//提供一种方法,以创建和格式化用于描述 XML Web services 的有效的 Web 服务描述语言 (WSDL) 文档文件。该文件是完整的,具有适当的命名空间、元素和属性。无法继承此类。
//read已重载。通过直接加载 XML 来初始化 ServiceDescription 类的实例。
System.Web.Services.Description.ServiceDescription sd = System.Web.Services.Description.ServiceDescription.Read(stream);
//公开一种为 XML Web services 生成客户端代理类的方法。
System.Web.Services.Description.ServiceDescriptionImporter sdi = new System.Web.Services.Description.ServiceDescriptionImporter();
//将指定的 ServiceDescription 添加到 ServiceDescriptions 集合。
sdi.AddServiceDescription(sd, "","");
//System.CodeDom 命名空间包含可以用于表示源代码文档的元素和结构的类。此命名空间中的类可用来建立源代码文档结构的模型,使用 System.CodeDom.Compiler 命名空间提供的功能可以将源代码文档输出为所支持语言的源代码。
//表示命名空间声明。
System.CodeDom.CodeNamespace cn = new System.CodeDom.CodeNamespace(@namespace);
//为 CodeDOM 程序图形提供容器
//可以存储包含 CodeDOM 源代码图形的 CodeNamespace 对象的集合、项目引用的程序集的集合,以及项目程序集的属性集合。
System.CodeDom.CodeCompileUnit ccu = new System.CodeDom.CodeCompileUnit();
//获取命名空间的集合。
ccu.Namespaces.Add(cn);
//从指定的命名空间导入 ServiceDescription,并生成客户端代理类的代码。
sdi.Import(cn,ccu);
//提供对 C# 代码生成器和代码编译器的实例的访问
Microsoft.CSharp.CSharpCodeProvider csc = new Microsoft.CSharp.CSharpCodeProvider();
//获取 C# 代码编译器的实例
System.CodeDom.Compiler.ICodeCompiler icc = csc.CreateCompiler();
//
System.CodeDom.Compiler.CompilerParameters cplist = new System.CodeDom.Compiler.CompilerParameters();
//
cplist.GenerateExecutable = false;
//
cplist.GenerateInMemory = true;
cplist.ReferencedAssemblies.Add("System.dll");
cplist.ReferencedAssemblies.Add("System.XML.dll");
cplist.ReferencedAssemblies.Add("System.Web.Services.dll");
cplist.ReferencedAssemblies.Add("System.Data.dll");
cplist.
//
System.CodeDom.Compiler.CompilerResults cr = icc.CompileAssemblyFromDom(cplist, ccu);
if(true == cr.Errors.HasErrors)
&leftsign;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
foreach(System.CodeDom.Compiler.CompilerError ce in cr.Errors)
&leftsign;
sb.Append(ce.ToString());
sb.Append(System.Environment.NewLine);
&rightsign;
throw new Exception(sb.ToString());
&rightsign;
System.Reflection.Assembly assembly = cr.CompiledAssembly;
Type t = assembly.GetType(@namespace+"."+classname,true,true);
//
object obj = Activator.CreateInstance(t);
System.Reflection.MethodInfo mi = t.GetMethod(methodname);
return mi.Invoke(obj,args);
&rightsign;
catch(Exception ex)
&leftsign;
throw new Exception(ex.InnerException.Message,new Exception(ex.InnerException.StackTrace));
&rightsign;
&rightsign;
20070527 SaferRun 1.00
http://www.yippeesoft.com
SaferRun:DropMyRights GUI程序
原理+源代码:
http://www.microsoft.com/china/msdn/library/security/ussecure11152004.mspx?mfr=true
CreateProcessAsUser() windowstations 和桌面
http://support.microsoft.com/kb/165194/
CreateProcessAsUser在c#中的调用
http://www.cnblogs.com/liefeng123/archive/2006/10/19/533743.html
The Windows Access Control Model Part 2
http://www.codeproject.com/win32/accessctrl2.asp
SaferRun.xml
<?xml version="1.0" encoding="utf-8"?>
<saferrun>
<menunum>1</menunum>
<menu0 name="IE">D:\\Program Files\\Internet Explorer\\iexplore.exe</menu0>
</saferrun>
从这里LOAD菜单,显示为NAME 字样
点击后 以普通用户运行指定程序
显示在状态区
需要.NET FRAMEWORK 2.0
本来想都用C#,不过那些函数IMPORT太麻烦,干脆用VC封装DLL,C# 再传递STRING
本来想增加XML编辑,如增加 删除 编辑等,不过那种处理太烦琐了,算了
editplus、ms word等编辑器都可以使用alt选择的方法 切换到 列模式
xd.Load("E:/test.xml");
给定编码中有无效的字符。
XML以<?xml version="1.0" encoding="utf-8"?> 编码格式保存
标签:err, saferrun 20070526 SaferRun 开发 ToolStripMenuItem
http://www.yippeesoft.com
C#代码辅助工具Visual Assist X 与 VS2005的代码自动提示发生冲突的解决办法
在 Visual Assist X 设置好代码快捷方式以后,比如 if 的快捷方式设置成:
if($select$)
&leftsign;
$end$
&rightsign;
在VS代码编辑窗口中编辑时,发现与VS自己的 if 快捷方式发生了冲突,Assist 的if出不来。
于是设置VS的属性N次,找到了解决问题的办法,如下:
工具 >> 选项 >> 文本编辑器 >> C#
1、常规: 将“语句结束”自动列出成员,隐藏高级成员选中
2、Intellisense:将“完成列表”中的“键入字符后显示完成列表”去掉,不选中。其他的项目不去动他。
C# winform程序中动态菜单的问题
给应用程序动态增加菜单
例:
popMenuItem 是父菜单,可以是菜单条上的主菜单项目也可以是下拉菜单中的菜单项
DynMenuItem_Click(object sender, EventArgs e) 是菜单响应函数
&leftsign;
ToolStripMenuItem item = (ToolStripMenuItem)sender;
item 是当前单击的新菜单项
&rightsign;
ToolStripMenuItem item = new ToolStripMenuItem("动态菜单Text" ,null,new System.EventHandler(this.DynMenuItem_Click),"menuItemName");
popMenuItem.DropDownItems.Add(item);
c# 分隔符 new ToolStripMenuItem
private void Form1_Load(object sender, EventArgs e)
&leftsign;
XmlDocument doc = new XmlDocument();
//如果网络不畅的话则有可能会抛出WebException的。
doc.Load(tvListPath);
XmlElement ele = doc.DocumentElement;
XmlNodeList nodeList = ele.SelectNodes("item"); //得到一个名字为IIFF的所有节点
ConfigMainMenu(nodeList, this.menuStrip1, null);
&rightsign;
//包含菜单项内容的xml文件的地址。
private const string tvListPath = @"http://uploadlist.googlepages.com/OnlineTV.xml";
private void commonToolStripMenuItem_Click(object sender, EventArgs e)
&leftsign;
ToolStripMenuItem menuItem = sender as ToolStripMenuItem;
Debug.Assert(menuItem != null);
//未set的Name取出来的将是"",所以如此进行判断
if (menuItem.Name != "")
&leftsign;
Process.Start(menuItem.Name);
&rightsign;
&rightsign;
/**//// <summary>
/// 递归函数,向主窗体中加入菜单项。
/// </summary>
/// <param name="nodeList"></param>
/// <param name="menuStrip"></param>
/// <param name="menuItem"></param>
public void ConfigMainMenu(XmlNodeList nodeList, MenuStrip menuStrip, ToolStripMenuItem menuItem)
&leftsign;
foreach (XmlNode node in nodeList)
&leftsign;
if (node.Name == "item")
&leftsign;
XmlAttributeCollection attribute = node.Attributes;
XmlAttribute text = attribute["text"];
if (text != null)
&leftsign;
XmlAttribute address = attribute["address"];
//根据xml文件的内容新建一个菜单项。
ToolStripMenuItem subItem = new ToolStripMenuItem(text.Value);
if (address != null)
&leftsign;
subItem.Name = address.Value;
&rightsign;
subItem.Click += new EventHandler(commonToolStripMenuItem_Click);
addItem(menuStrip, menuItem, subItem);
ConfigMainMenu(node.ChildNodes, null, subItem);
&rightsign;
&rightsign;//如果指示为分隔符的话:
else if (node.Name == "separator")
&leftsign;
ToolStripSeparator toolStripSeparator = new ToolStripSeparator();
addItem(menuStrip, menuItem, toolStripSeparator);
&rightsign;
else
&leftsign;
throw new InvalidDataException("节点的名称有误,请检查");
&rightsign;
&rightsign;
&rightsign;
20070525 SaferRun 开发 用户权利 c# menu
http://www.yippeesoft.com
用户权利简介管理员可以指派特定权利组帐户或单个用户帐户。这些权利批准用户执行特定的操作,如交互式登录系统或备份文件和目录。用户权利与权限不同,因为用户权利适用于用户帐户,而权限则附加给对象。有关权限的信息,请参阅继承如何影响文件和文件夹的权限。
用户权利定义了本地级别上的功能。虽然用户权利可以应用于单个的用户帐户,但最好是在组帐户基础上管理。这样可以确保作为组成员登录的帐户将自动继承该组的相关权利。通过对组而不是对单个用户指派用户权利,可以简化用户帐户管理的任务。当组中的用户都需要相同的用户权利时,您可以一次对该组指派用户权利,而不是重复地对每个单独的用户帐户指派相同的用户权利。
对组指派的用户权利应用到该组的所有成员(在它们还是成员的时候)。如果用户是多个组的成员,则用户权利是累积的,这意味着用户有多组权利。指派给某个组的权利只有在特定登录权利的情况下才会与指派给其他组的权利发生冲突。然而,指派给某个组的用户权利通常不会与指派给其他组的权利冲突。要删除用户的权利,管理员只需简单地从组中删除用户。在这种情况下,用户不再拥有指派给这个组的权利。
有两种类型的用户权利:特权,如备份文件和目录的权利;另一种是登录权利,如登录到本地系统的权利。
详细信息,请参阅特权和登录权利。
c#中,在load事件中Form不能用Hide()方法?
试试看,好像没有效。
问题解决了,是在Form1_Activated中加入this.Hide();。
D:\\WINDXP\\Microsoft.NET\\Framework\\v2.0.50727\\Csc.exe /noconfig /nowarn:1701,1702 /warn:4 /define:DEBUG;TRACE /reference:D:\\WINDXP\\assembly\\GAC_MSIL\\Microsoft.VisualStudio.QualityTools.UnitTestFramework\\8.0.0.0__b03f5f7f11d50a3a\\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll /reference:"H:\\temp\\My Documents\\Visual Studio 2005\\Projects\\SaferRun\\SaferRun\\bin\\Debug\\SaferRun.exe" /reference:D:\\WINDXP\\Microsoft.NET\\Framework\\v2.0.50727\\System.Data.dll /reference:D:\\WINDXP\\Microsoft.NET\\Framework\\v2.0.50727\\System.Deployment.dll /reference:D:\\WINDXP\\Microsoft.NET\\Framework\\v2.0.50727\\System.dll /reference:D:\\WINDXP\\Microsoft.NET\\Framework\\v2.0.50727\\System.Drawing.dll /reference:D:\\WINDXP\\Microsoft.NET\\Framework\\v2.0.50727\\System.Windows.Forms.dll /reference:D:\\WINDXP\\Microsoft.NET\\Framework\\v2.0.50727\\System.Xml.dll /debug+ /debug:full /optimize- /out:obj\\Debug\\TestProject1.dll /target:library ProgramTest.cs Properties\\AssemblyInfo.cs Resources.DesignerTest.cs SaferRunTest.cs Settings.DesignerTest.cs VSCodeGenAccessors.cs
H:\\temp\\My Documents\\Visual Studio 2005\\Projects\\SaferRun\\TestProject1\\SaferRunTest.cs(78,44): 错误 CS0118: “SaferRun”是“命名空间”,但此处被当做“类型”来使用
SaferRun.SaferRun target = new SaferRun();
using SaferRun;
今天上午用VS的WebApplication编一个站外提交的程序的时候在调试的过程中出现 “HttpWebRequest”是“命名空间”,但此处被当做“类型”来使用”的报错信息,一开始以为是我的程序有问题(还怀疑是不是 WebApplication的问题),而后用Asp.net来实现没有任何问题,吃过饭后来重新建立了一个WebApplication程序居然没有任何报错,此时心里非常高兴,因为可以排除WebApplication的因素了,最终分析原因居然是我用了HttpWebRequest这个名称作为项目的名称的问题,将项目名称更换成Http_Request调试通过。
由此可以看到微软VS工具还是有些不完善的地方的,报错信息不是很人性化,当然希望大家也不要向我一样犯此等低级错误,在项目命名的时候尽量不要将名称特殊化和简单化,并且避免使用中文目录名或者项目名称,切记!
命名空间和类同名
有多个根元素
有多个根元素。 行 109,位置 9。
make sure your string is a valid xml string, which means, one root element,…
String YourString = "<Data><hangbiaoshi>1</hangbiaoshi><name>ee</name></Data>";
StringReader reader = new StringReader(YourString);
DataSet ds = new DataSet();
ds.ReadXml(reader);
foreach (DataTable t in ds.Tables)
&leftsign;
Console.WriteLine("&leftsign;0&rightsign; has &leftsign;1&rightsign; records", t.TableName, t.Rows.Count);
foreach (DataColumn dc in t.Columns)
Console.WriteLine(dc.ColumnName);
&rightsign;
or if you see that error, add "<DataSet>" + YourString + "</DataSet>"
Dim Menu As New ContextMenuStrip
Menu.Items.Add("添加")
不知如何将MenuAdd_Click()的过程加给生成的快捷菜单的"添加"的Click事件
也就是说:生成的快捷菜单的"添加"的Click后,运行我已经写好的MenuAdd_Click()过程
Dim Menu As New ContextMenuStrip
Dim MI As MenuItem = Menu.Items.Add("添加")
AddHandler MI.Click, AddressOf MenuAdd_Click
this.contextMenuStrip1.Items.Add(toolStripMenuItem1);
Step1.我们需要建立项目文件与测试文件的映射关系.
难道要我们去手动创建吗?这可是整个项目啊,里面也许包含了几十个类,数百个方法…当然没那么复杂!实际上,我们需要做的工作很少,只是动动鼠标,等几秒就可以了:)
在VS2005 的IDE环境下,选择menu里的Test,继续选New Test项,这时将跳出个窗体,里面可以选择测试项目类型,这里我们选择Unit Test Wizard,确定,输入测试项目名,然后将又出现一个窗体,里面包含你当前的solution里的所有project,我们选上我们的MyCache, 确定.OK,看见一个进度条,这是在执行测试代码的映射工作,等结束后,你就会发现,已经建立了一个测试项目了,里面的文件完全对应你的目标项目,每个类包含的方法也是与目标类的方法一一对应,非常简单,cool,mission complete!
Step2.运行我们的测试项目.
接下来,我们怎么进行测试呢?里面有许多的类和方法,很多方法上还带有像TestMethod这样的标签属性,但是我们关心的是,如何进行测试?绝对不是通常的F5来运行:(,在VSTS里,单元测试实际上有专门的管理工具.再次选到menu上的Test选项,移到windows上展开自菜单,里面有好几个选项,我们选择TestManager打开.在IDE窗口内出现了一个视图结构的东西,在分割线的右边是一个listView,里面全是当前测试项目包含的方法,我们随便选几个方法给勾上,右键,Run Checked Test,下边马上有出现了Test Result窗体,里面就是刚才你选择的方法.如果不出意外的话,你的这个窗体内的方法result应该都是failed之类的数据,嗯,先不管这个,最起码,我们已经运行了一次测试项目了,虽然有些奇怪,不过我们已经知道了如何运行一个测试项目了,那么再进入下一个step吧:)
Step3.看看我们的测试代码里都有些什么.
虽然知道了怎么运行测试项目,但莫名其妙的全部出错,是怎么回事呢?我们进入测试项目具体的代码来看看.
我们会发现,每个测试类的名称就是对应的目标类的名称+"test",里面的方法也是如此,如果是构造函数,则是诸如
ConstructorTest 或ConstructorTestN这样的形式,N为重载次数.每个方法里面的代码看上去也不奇怪,只是构造参数来调用而已,最后通过断言来判断(用过 NUnit的朋友不会陌生吧?).我们试着直接把一个方法里的断言去掉看看,编译,TestManager,run,嘿,果然,去掉断言的方法就pass 了!看来蒙老大不难呢,只要把所有的方法的断言都给去掉,然后给老大看测试后的结果,呵呵…
Step4.深入的了解一下方法上带有的属性的含义.
每个方法上几乎都带有TestMethod这个属性,我们直觉告诉我们,这肯定是表示被测试函数的意思.事实也正是如此,在Unit Test里,有许多测试属性,常用的如下:
属性 描述
TestClass()
该属性表示一个测试装置。
TestMethod()
该属性表示一个测试用例。
AssemblyInitialize()
在执行为执行选择的第一个 TestClass() 中的第一个 TestMethod() 之前,执行带有该属性的方法。
ClassInitialize()
带有该属性的方法在执行第一个测试之前调用。
TestInitialize()
带有该属性的方法在执行每个 TestMethod() 之前调用。
TestCleanup()
带有该属性的方法在执行每个 TestMethod() 之后调用。
ClassCleanup()
带有该属性的方法在执行 ALL 测试之后调用。
AssemblyCleanup()
在执行为执行选择的第一个 TestClass() 中的第一个 TestMethod() 之后,执行带有该属性的方法。
Description()
提供关于给定 TestMethod() 的描述。
Ignore()
由于某种原因忽略 TestMethod() 或 TestClass()。
ExpectedException()
当测试特定异常时,如果使用该属性指定的异常不是从实现代码引发,则测试不会失败。
需要注意的是,上面的属性不是可以适用于所有方法的,比如AssemblyInitialize()和ClassInitialize()是必须是静态方法的属性.
我们可以把初始化的操作放在他们里进行.
Step5.修改测试方法及其断言.
到现在,我们的思路开始清晰起来了,我们要开始做真正的测试了,不是仅仅去掉断言就pass那么简单了:)
我们的测试思路应该是这样:我们调用该方法,需要传入什么值,会影响什么值,当它执行之后,会产生怎样的期待值?我们把期待值与实际的值想比较,同时写下断言失败的message.
还是以我们的MyCahce为例,假如我们有个ListCache类,里面有个AddItemToTop(item)方法,表示把一个item插入到当前链表的头部.我们实际的测试函数该这么写
Guid id = System.Guid.NewGuid();
Item item = new Item(id);
list.AddItemToTop(item);
Assert.AreEqual(id, roomList.FirstLinkedItem.Key, "插入后查询获得的key值与插入的对象的key值不相等!");
通过比对插入后的链表的头部的key与之前保存的key值来判断,这是不是一次成功的插入.
这只是个很简单的例子,我们当然应该根据具体的方法需要实现的功能来定义测试代码.
Step6.OVER
完成了上面5部,相信你已经对VSTS的Unit Test非常的熟悉了,接下来需要做的就是把你需要的测试的method都提供正确的测试代码,注意,这里我们甚至不要考虑我们本身的项目究竟有没有实现该功能,但我们应该该知道,我们需要什么功能.我们只针对应该产生的结果写测试代码.当测试不通过时,我们只需要修改我们的目标项目,而不再需要修改我们的测试项目.这其实正是TDD(测试驱动开发)的思想,我们如果要验证我们的方法有没有错,只需要run一下test即可,真正实现了全自动化单元测试, 这里边的实际开发效率的提高,只有你在真正体会过后才能明白:)
20070524 SaferRun 开发
http://www.yippeesoft.com
error C2065: “_lpa” : 未声明的标识符
error C2065: “_convert” : 未声明的标识符
error C2065: “_acp” : 未声明的标识符
error C3861: “_lpa”: 即使使用参数相关的查找,也未找到标识符
error C3861: “_convert”: 即使使用参数相关的查找,也未找到标识符
error C3861: “_lpa”: 即使使用参数相关的查找,也未找到标识符
error C3861: “_convert”: 即使使用参数相关的查找,也未找到标识符
#include <atlconv.h>
USES_CONVERSION;
LPSTR lpstr = OLE2A(bstrVal); // bstrVal为BSTR类型变量
USES_CONVERSION是个宏,展开后定义一些局部变量以供WideCharToMultiByte或 MultiByteToWideChar使用,因为上面各位说的各种转换方法归根结底都是通过这两个函数进行转换的,只不过包装方法不同而已。下面的代码摘自MFC源码
#define USES_CONVERSION int _convert; _convert; UINT _acp = GetACP(); _acp; LPCWSTR _lpw; _lpw; LPCSTR _lpa; _lpa
#define A2W(lpa) ( ((LPCSTR)lpa == NULL) ? NULL : ( _convert = (strlen(lpa)+1), AfxA2WHelper((LPWSTR) alloca(_convert*2),
lpa, _convert) ))
但是还有个函数(StringCchLength())不能识别,又到MSDN里一查,少加这个函数所在的头文件(strsafe.h)
DLL的export
DLL中包含有一个表,称为export table(以下简称ET),其中包含了DLL中可以被外部程式使用的所有函数和数据的名字。只有记录在ET中的函数和数据才可以被外部程式所使用(如果没有.DEF文件的话),其它所有没有记录在ET中的函数和数据都被视为是DLL私有的。因此,要将DLL中的函数和数据export只有两个方法:
l 为DLL创建一个.DEF文件(模块定义文件),并在build该DLL时使用这个.DEF文件。使用这种方法使你可以将函数按序号export。
l 在DLL中想要export的函数和数据定义前添加_declspec(dllexport)关键字(对于函数和变量定义,加在最前面;对于class定义,加在class关键字后),这样该函数和数据就会被添加到ET中。使用这种方法函数将按名字export。
在WINDOWS下,无论使用上述的哪一种方法,都必须要将export函数声明为_stdcall。
c#调用dll问题,在vb里可以调通,可在c#中不知道什么问题
自己写的mydll.dll,用vc做的
包括有函数类似,myfunc(LPSTR string1)
用vb调声明之后,直接myfunc("323435")没有问题
可在c#中,声明之后,同样myfunc("323435")
发现传过去的参数,只取了第一个字符,此时的string1="3"
是不是这跟字符编码有关?
[DllImport(“MyDLL.dll”)]在申明的时候还可以添加几个属性
[DllImport(“MyDLL.dll", EntryPoint=" mySum ",CharSet=CharSet.Auto,CallingConvention=CallingConvention.StdCall)
]
EntryPoint: 指定要调用的 DLL 入口点。默认入口点名称是托管方法的名称 。
CharSet: 控制名称重整和封送 String 参数的方式 (默认是UNICODE)
CallingConvention指示入口点的函数调用约定(默认WINAPI)(上次报告讲过的)
SetLastError 指示被调用方在从属性化方法返回之前是否调用 SetLastError Win32 API 函数 (C#中默认false )
如果是用的大小顺序的字节码
System.Text.Encoding.BigEndianUnicode.GetString(byte[]);
如果是用的小大顺序的unicode
System.Text.Encoding.Default.GetString(byte[]);
oCharArray()函数实现的是从字符串到Unicode 字符数组的转换的,
它有两种形式,你用的是第二种,第一个参数代表数组的起始位置,第二个参数代表转换长度,
这种方式适合已经定义好的数组(而不是声明好的数组),
如果是想把一个字符串完全转换到另一个数组中,那么就用它的第一种形式,不带参数的。
string yb = "abc";
char[] yy = yb.ToCharArray()
正解:CharSet = CharSet.Ansi
C#调用vc写的dll,出现找不到入口点
do this:
extern "C" __declspec(dllexport) BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
&leftsign;
return TRUE;
&rightsign;
you need to export the function.
写了一个vc++的dll, 利用 [DllImport] 调用,运行没有错误, 无法到达dll中的源代码中设置的端点,端点处为问号,提示为“无法命中端点,该文本没有加载任何符号”,结果是没法去调试该dll, 我试过了, 第一, 我都试过了,无论从c#那个工程作为启动工程或者是vc那个dll作为启动工程,都到达不了预先设置的断点,从模块加载窗口中,看不到该dll被加载,我在怀疑DllImport的机制。
第二,那个dll若不是基于.net平台, 根本就不让加。所以附加的方式也是不对的!
正解:把C#项目属性改为启用非托管调试。将dll依附的进程的DEBUG TYPE设置为MIXED TYPE即可,即托管[managed]和本地[native]混合模式即可
标签:err, saferrun, 开发20070523 SaferRun 资料
http://www.yippeesoft.com/
以管理员身份安全地浏览 Web 和读取电子邮件
http://www.microsoft.com/china/msdn/library/security/ussecure11152004.mspx?mfr=true
“用管理帐户运行会危及您的计算机和数据”,对此我已经说过多次,但是我将再重申一遍。因此,当某个人说他们必须以管理员身份操作计算机时,我总是试图说服他们,从安全的角度来看,这不是正确的操作。说归说,我偶尔也会碰到理由充分的人。例如,我使用办公室内的某台计算机安装最新的 Windows 日更新版本,并且我需要以管理员身份安装 OS。但是,当我以管理员身份在该计算机上运行时,不会以任何方式读取电子邮件、浏览 Web 或访问 Internet,这一点很重要。我之所以不这样做,是因为 Web 是当今大多数令人讨厌的攻击的来源。
如果某个人确实希望浏览 Web,该怎么办?亦或是读取电子邮件,或者进行即时消息处理等,而且由于某种原因必须在管理上下文中运行,那该怎么办?如果您查看对计算机的主要威胁,就会发现它们都来自用户通过浏览器和电子邮件客户程序等工具与 Web 进行的交互。
Windows XP 和 Windows Server 2003 以及更高版本都支持名为软件限制策略(又称为 SAFER)的功能,该功能允许用户或软件开发人员以较低的特权运行代码,而无需让用户在应用程序启动时输入凭据信息。例如,管理员可以在应用程序启动时,从应用程序的令牌中去掉某些 SID 和特权,从而以普通用户身份运行应用程序。一些应用程序(最典型的是面向 Internet 的应用程序,如 Web 浏览器、即时消息或电子邮件客户程序)绝对不能在管理上下文中运行。
返回页首返回页首
DropMyRights 应用程序
DropMyRights 是一个非常简单的应用程序,它可以帮助那些必须以管理员身份运行的用户在更安全的上下文(非管理员的上下文)中运行应用程序。这是通过以下方法来完成的:提取当前用户的令牌,从该令牌中删除各种特权和 SID,然后使用该令牌启动另一个进程(如 Internet Explorer 或 Outlook)。该工具完全适用于 Mozilla 的 Firefox、Eudora 或 Lotus Notes 电子邮件。
http://www.codeproject.com/csharp/accessctrl3.asp
This four part series will discuss the Windows Access Control model and its implementation in Windows NT and 2000. In the third part of the series, we will delve into the new security classes introduced for version 2.0 of the .NET framework.
I\’m not sure if you have read parts 1 and 2 of this series. If you are new to ACL based security and haven\’t read part 1[^], I strongly recommend you read it before continuing. (Don\’t worry. Even though it\’s in the C++ section, there isn\’t much C++ code in it.) Part 2 should be safe to skip if you are a .NET programmer. To prepare for part 3, make sure you have a copy of Visual Studio 2005 and the .NET Framework v2.0 (currently in beta 2).
This article is based on a pre-release version of Visual Studio. The framework may change in future releases, meaning the code may not work in the final version.
http://support.microsoft.com/kb/165194/
CreateProcessAsUser() windowstations 和桌面
通过的 CreateProcessAsUser 函数, 启动进程时进程将会启动到 windowstation 和桌面组合根据 lpDesktop STARTUPINFO 结构参数中的值:
• 如果 windowstation 和桌面组合 lpDesktop 成员, 中指定系统将尝试启动到该 windowstation 和桌面进程。
• 如果 lpDesktop 成员初始化为 NULL, 系统将尝试使用同一 windowstation 和桌面作为调用进程如果系统是与交互 windowstation。
• 如果不 lpDesktop 成员初始化为 NULL, 系统将创建新 windowstation 和桌面, 您无法看到。
• 如果用空字符串, 初始化系统 " "、 将或者创建新 windowstation 和桌面, 无法看到, 或通过相同如果之一是否已创建通过的以前调用访问令牌, 现有 windowstation, 将使用桌面。
http://www.cnblogs.com/liefeng123/archive/2006/10/19/533743.html
在windows系统中,有时需要在程序中以其他用户身份运行另外的exe程序,需要用
到advapi32.dll中的CreateProcessAsUser函数,在msdn中该函数原型为:
BOOL CreateProcessAsUser(
HANDLE hToken,
LPCTSTR lpApplicationName,
LPTSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
DWORD dwCreationFlags,
LPVOID lpEnvironment,
LPCTSTR lpCurrentDirectory,
LPSTARTUPINFO lpStartupInfo,
LPPROCESS_INFORMATION lpProcessInformation);关于个参数的具体说明msdn上有详细说明
就不在这里重复了。
需要提出说明的是hToken参数,在使用这个函数的时候,token 需要采用DuplicateTokenEx
函数来复制当前的token否则会出现1349的错误。关于DuplicateTokenEx的具体说明请参阅msdn.
http://www.codeproject.com/win32/accessctrl2.asp
This 4 part series will discuss the Windows Access Control model and its implementation in Windows NT and 2000.
In this second article we will start programming with security identifiers, access control lists and security descriptors. We will solve trivial problems using the SID, obtain information from an access token, enable a privilege, fill up an access control list, and finally we will check if we have access to a resource. The demo project provided is a Whoami clone written in Windows 2000 style. The source code includes equivalent programs of the article\’s code written with the low level APIs, the Windows 2000 APIs, and the Active Template Library.
http://www.codeproject.com/win32/accessctrl2.asp
http://www.tutorials-se.com/platformsdksecurity/Vista-admin/
Vista: How can an admin application start another application in the standard user context?
20070117 XML Error C00CE508
WWW.SHENGFANG.ORG
XML Error C00CE508 文本内容发现无效内容
Hello,
I try to transform the file xml.xml with the xsl-file xsl.xsl to the file csv.csv.
When I run the command line "msxsl.exe xml.xml xsl.xsl >csv.csv" everything is sweet. If I try to do the same via C++ and DOM, I get:
URL: <– Empty !!!
Line: 1
Character: 148
Error[ c00ce508 ]: An invalid character was found in text content.
The code for the Console-MFC application comes in the next post.
I\’m using ADO recordset Save method to spit the result into XML format and then feeding the resultant XML to XMLDOMObject to display the data based on XSL.
Here the issue is – one of the field having a text value with \’1/2\’ and \’3/4\’ symbols in it. XML parser complains that \’An invalid character was found in text content\’ with Error code \’C00CE508\’
为啥俺的XML文件不支持中文?提示为“无效字符”
你把<xml version="1.0" encoding="UTF-8">改成<xml version="1.0" encoding="GB2312">
就可以了.
其实用<? xml version="1.0" encoding="UTF-8" ?>也可以是中文。
只是节点名不能是中文.. 用<?xml version="1.0" encoding="gb2312" ?>
的话节点名就可以是中文了..
// XMLTest.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "XMLTest.h"
#include <TCHAR.H>
#include <stdio.h>
#include <time.h>
#import "msxml4.dll"
#include "..\\PMKUtils\\MSXML4\\inc\\msxml2.h"
using namespace MSXML2;
inline void EVAL_HR( HRESULT _hr )
&leftsign; if FAILED(_hr) throw(_hr); &rightsign;
class CMSXMLTransformer
&leftsign;
public:
CString m_sError;
void printMSXMLError(const IXMLDOMDocument2Ptr& pXMLDoc);
_variant_t loadDocument(IXMLDOMDocument2Ptr& pXMLDoc, LPCTSTR szDocURL, bool bOverHTTP);
static bool isMSXMLInstalled();
CMSXMLTransformer();
virtual ~CMSXMLTransformer();
bool transform( const CString & sXMLSource, const CString & sXSLTScript, const CString & sOutput );
&rightsign;;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// The one and only application object
CWinApp theApp;
using namespace std;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CMSXMLTransformer::CMSXMLTransformer()
&leftsign;
&rightsign;
CMSXMLTransformer::~CMSXMLTransformer()
&leftsign;
&rightsign;
//——————————————————————
//
// Check if MSXML 4.0 is installed.
//
//——————————————————————
bool CMSXMLTransformer::isMSXMLInstalled()
&leftsign;
try
&leftsign;
_TCHAR szTemp[ _MAX_PATH ];
HKEY hKey;
DWORD retCode, dwLen;
retCode = RegOpenKeyEx(HKEY_CLASSES_ROOT,
_T("CLSID\\\\&leftsign;88d969c0-f192-11d4-a65f-0040963251e5&rightsign;\\\\InProcServer32"),
0,
KEY_QUERY_VALUE,
&hKey);
if (retCode != ERROR_SUCCESS) return false;
retCode = RegQueryValueEx(hKey, _T(""), NULL, NULL, (LPBYTE)szTemp, &(dwLen = sizeof(szTemp)));
if (retCode != ERROR_SUCCESS) return false;
RegCloseKey(hKey);
double dVer;
int i;
for (i = _tcslen(szTemp); i >= 0; –i)
&leftsign;
if (szTemp[i] == _T(\’\\\\\’))
break;
&rightsign;
if (_stscanf(szTemp + i + 1, _T("msxml%lf"), &dVer) == 0 &line;&line; dVer < 4.0)
&leftsign;
_ftprintf(stderr, _T("\\nError: MSXML 4.0 is not installed. Exiting.\\n"));
return false;
&rightsign;
else
&leftsign;
return true;
&rightsign;
&rightsign;
catch(…)
&leftsign;//Exception handling
&rightsign;
return false;
&rightsign;
//——————————————————————
//
// Load the XML document using DOM
//
//——————————————————————
_variant_t CMSXMLTransformer::loadDocument(IXMLDOMDocument2Ptr &pXMLDoc, LPCTSTR szDocURL, bool bOverHTTP)
&leftsign;
_variant_t varLoadResult((bool)FALSE);
try
&leftsign;
// Create MSXML DOM object
EVAL_HR(pXMLDoc.CreateInstance("Msxml2.DOMDocument.4.0"));
// Load the document synchronously
pXMLDoc->async = false;
pXMLDoc->validateOnParse = true;
if( bOverHTTP)
&leftsign;
// If loading the document over HTTP (see KB Q321125 for details)
pXMLDoc->setProperty("ServerHTTPRequest", VARIANT_TRUE);
&rightsign;
// Load the XML document
varLoadResult = pXMLDoc->load(szDocURL);
&rightsign;
catch(…)
&leftsign;//Exception handling
ASSERT( false );
&rightsign;
return varLoadResult;
&rightsign;
//——————————————————————
//
// Uses DOMDocument parseError to print the error message
//
//——————————————————————
void CMSXMLTransformer::printMSXMLError(const IXMLDOMDocument2Ptr &pXMLDoc)
&leftsign;
try
&leftsign;
// Get parseError interface
IXMLDOMParseErrorPtr pError = NULL;
EVAL_HR(pXMLDoc->get_parseError(&pError));
m_sError = (const char *)pError->reason;
DWORD dwLine = (DWORD) pError->line;
DWORD dwLinePos = (DWORD) pError->linepos;
DWORD dwCode = (DWORD)pError->errorCode;
CString sFile;
sFile = (const char *)pError->url;
if( dwCode != 0 )
&leftsign;
m_sError.Format(
"URL: %s\\nLine: %ld\\nCharacter: %ld\\nError[ %08x ]: %s",
sFile,
dwLine,
dwLinePos,
dwCode,
(const char*) pError->reason );
TRACE( m_sError );
&rightsign;
&rightsign;
catch(…)
&leftsign;//Exception handling
ASSERT( false );
&rightsign;
&rightsign;
bool CMSXMLTransformer::transform( const CString & sXMLSource, const CString & sXSLTScript, const CString & sOutput )
&leftsign;
bool bRes = false;
try
&leftsign;
EVAL_HR(CoInitialize(NULL));
// Make sure that MSXML 4.0 is installed
if (!isMSXMLInstalled())
return false;
IXMLDOMDocument2Ptr pXMLDoc = NULL;
IXMLDOMDocument2Ptr pXSLDoc = NULL;
// Load the XML document
if (loadDocument(pXMLDoc, sXMLSource, true))
&leftsign;
// Load the stylesheet
if (loadDocument(pXSLDoc, sXSLTScript, false))
&leftsign;
// The source XML document DOM object is reused to hold
// the transformed XML. Get the dispatch interface to do this.
VARIANT vObject;
IDispatch *pDisp;
LPCTSTR pOutput = sOutput;
EVAL_HR(pXMLDoc->QueryInterface(IID_IDispatch, (void **)&pDisp));
vObject.vt = VT_DISPATCH;
vObject.pdispVal = pDisp;
// Apply the transformation
EVAL_HR(pXMLDoc->transformNodeToObject(pXSLDoc, &vObject));
printMSXMLError(pXMLDoc);
if( bRes = m_sError == "" )
&leftsign;
pXMLDoc->save( pOutput );
&rightsign;
&rightsign;
else
&leftsign;
printMSXMLError(pXSLDoc);
&rightsign;
&rightsign;
else
&leftsign;
printMSXMLError(pXMLDoc);
&rightsign;
&rightsign;
catch(…)
&leftsign;//exception handling
ASSERT( FALSE );
&rightsign;
CoUninitialize();
return bRes;
&rightsign;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
&leftsign;
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
&leftsign;
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
&rightsign;
else
&leftsign;
// TODO: code your application\’s behavior here.
CString strHello;
strHello.LoadString(IDS_HELLO);
cout << (LPCTSTR)strHello << endl;
CMSXMLTransformer Transformer;
Transformer.transform( "xml.xml", "xsl.xsl", "csv.csv" );
if( Transformer.m_sError != "" )
&leftsign;
AfxMessageBox( Transformer.m_sError );
&rightsign;
&rightsign;
return nRetCode;
&rightsign;
1102 VC6 VC7 error C2440 AVI
error C2440: “static_cast” 无法从“void (__thiscall CChatManagerDlg::* )(WPARAM,LPARAM)”转换为“LRESULT (__thiscall CWnd::* )
VC7就以后版本要求自定义消息的原型是
LRESULT MessageHandler(WPARAM,LPARAM);
注意,如果是void MessageHandler(WPARAM,LPARAM),在以前的版本中虽然不提示编译错误,但运行时也会出问题的。
消息响应函数是要有long型返回值的,
VC++6允许你用void型返回值,并不表示你这样做是正确的,
VC++.NET增加了这一项安全检查,不再允许void返回值。
你把返回值改为RESULT型就可以了,
RESULT在32位下就是long,在64位下是int 64。
typedef struct _avistreamheader &leftsign;
FOURCC fcc; // 必须为‘strh’
DWORD cb; // 本数据结构的大小,不包括最初的8个字节(fcc和cb两个域)
FOURCC fccType; // 流的类型:‘auds’(音频流)、‘vids’(视频流)、
//‘mids’(MIDI流)、‘txts’(文字流)
FOURCC fccHandler; // 指定流的处理者,对于音视频来说就是解码器
DWORD dwFlags; // 标记:是否允许这个流输出?调色板是否变化?
WORD wPriority; // 流的优先级(当有多个相同类型的流时优先级最高的为默认流)
WORD wLanguage;
DWORD dwInitialFrames; // 为交互格式指定初始帧数
DWORD dwScale; // 这个流使用的时间尺度
DWORD dwRate;
DWORD dwStart; // 流的开始时间
DWORD dwLength; // 流的长度(单位与dwScale和dwRate的定义有关)
DWORD dwSuggestedBufferSize; // 读取这个流数据建议使用的缓存大小
DWORD dwQuality; // 流数据的质量指标(0 ~ 10,000)
DWORD dwSampleSize; // Sample的大小
struct &leftsign;
short int left;
short int top;
short int right;
short int bottom;
&rightsign; rcFrame; // 指定这个流(视频流或文字流)在视频主窗口中的显示位置
// 视频主窗口由AVIMAINHEADER结构中的dwWidth和dwHeight决定
&rightsign; AVISTREAMHEADER;
typedef struct _avimainheader &leftsign;
FOURCC fcc; // 必须为‘avih’
DWORD cb; // 本数据结构的大小,不包括最初的8个字节(fcc和cb两个域)
DWORD dwMicroSecPerFrame; // 视频帧间隔时间(以毫秒为单位)
DWORD dwMaxBytesPerSec; // 这个AVI文件的最大数据率
DWORD dwPaddingGranularity; // 数据填充的粒度
DWORD dwFlags; // AVI文件的全局标记,比如是否含有索引块等
DWORD dwTotalFrames; // 总帧数
DWORD dwInitialFrames; // 为交互格式指定初始帧数(非交互格式应该指定为0)
DWORD dwStreams; // 本文件包含的流的个数
DWORD dwSuggestedBufferSize; // 建议读取本文件的缓存大小(应能容纳最大的块)
DWORD dwWidth; // 视频图像的宽(以像素为单位)
DWORD dwHeight; // 视频图像的高(以像素为单位)
DWORD dwReserved[4]; // 保留
&rightsign; AVIMAINHEADER;
859189837 =mmioFOURCC(\’M\’,\’2\’,\’6\’,\’3\’);
#ifndef MKFOURCC
#define MKFOURCC( ch0, ch1, ch2, ch3 ) \\
( (DWORD)(BYTE)(ch0) &line; ( (DWORD)(BYTE)(ch1) << 8 ) &line; \\
( (DWORD)(BYTE)(ch2) << 16 ) &line; ( (DWORD)(BYTE)(ch3) << 24 ) )
#endif
#if !defined(_INC_MMSYSTEM)
#define mmioFOURCC MKFOURCC
#endif