惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
Security Latest
Security Latest
Simon Willison's Weblog
Simon Willison's Weblog
O
OpenAI News
GbyAI
GbyAI
L
LINUX DO - 最新话题
A
Arctic Wolf
T
Tor Project blog
G
GRAHAM CLULEY
I
InfoQ
博客园_首页
IT之家
IT之家
The Register - Security
The Register - Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
The GitHub Blog
The GitHub Blog
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
K
Kaspersky official blog
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
U
Unit 42
PCI Perspectives
PCI Perspectives
量子位
P
Palo Alto Networks Blog
S
Securelist
T
Troy Hunt's Blog
博客园 - 【当耐特】
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
Engineering at Meta
Engineering at Meta
T
The Blog of Author Tim Ferriss
博客园 - 聂微东
罗磊的独立博客
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
NISL@THU
NISL@THU
C
Cisco Blogs
T
Threatpost
有赞技术团队
有赞技术团队
Forbes - Security
Forbes - Security
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
T
The Exploit Database - CXSecurity.com
Cloudbric
Cloudbric
Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security

博客园 - hyamw

【转】代码审查工具fisheye/crucible安装及破解 Win11单语言系统添加美式键盘的方法 Unity中AndroidJavaProxy方法参数为null的坑 CentOS下安装dotnet tools工具报错 (转)支持 PS/2 与 USB 的键盘过滤驱动(可卸载) Unity编辑器扩展-Custom List, displaying data your way 值得推荐的C/C++框架和库 (真的很强大)〔转〕 SIGGRAPH2016【转】 VS2015调试UWP程序时提示错误DEP0700 : Registration of the app failed. Another user has already installed Unity 4.x Asset Bundle 重名 VC++ Debugger Tips[转] centos下postgresql的安装与配置[转] CentOS 访问Windows7共享文件夹 svn+ssh方式svn服务器和客户端的配置[转载] 利用Ptrace在Android平台实现应用程序控制[转] AS3地图拼接与战争迷雾的实现[转载] 一些游戏开发相关资料(收集) Bit Twiddling Hacks[转] Unity3D实用工具汇总[转]
在64位windows下使用instsrv.exe和srvany.exe创建windows服务[转]
hyamw · 2016-08-15 · via 博客园 - hyamw

本文转自:https://www.iflym.com/index.php/computer-use/201205020001.html

在32位的windows下,包括windows7,windows xp以及windows 2003,都可以使用instsrv.exe和srvany.exe来创建自定义的windows服务。比如,我们有一个bat文件,用于将指定的程序作为服务进行启动,使用一般的工具都不可以进行此类工作,而使用由windows 2003的资源工具包windows toolkit中所带的instsrv就可以。

详细的用法这里就不再具体叙述,简单一点就是使用instsrv将相应的srvany注册成服务,然后在注册表中增加相应的Application和AppDirectory参数,用于srvany启动我们所相应的服务。如下列代码所示://将相应程序生成成服务

1

2

3

4

5

6

7

8

9

set s32=%windir%\system32

%s32%\instsrv.exe %service_name% %s32%\srvany.exe

//在注册表中更新相应的参数

echo Windows Registry Editor Version 5.00> %reg_file%

echo >> %reg_file%

echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\%service_name%\Parameters] >> %reg_file%

echo "Application"="%prog_path%\\%prog_name%" >> %reg_file%//程序地址

echo "AppDirectory"="%prog_path%" >> %reg_file%//程序目录

以上的代码在所有的32位系统之上都可以正常的运行,包括windows 2000。然而,在64位的windows下,以上的代码却失效了。会报一个以下错误:

1

Unable to find the file at the given path

在仔细检查了参数之后,确定这是由于系统原因所引起的。

最终的原因在于,我们所使用的instsrv和srvany是32位的,而windows现在没有相对应的64位相对应工具发布。而程序本身是没有问题的,问题在于我们将instsrv和Srvany放到windows/system32正面,而在64位系统中,这里应该存放64位的程序,所以最终的解决问题很简单。我们只需要将这两个程序再copy至32位程序应该放置的地方,比如windows/sysWow64目录,这样就可以了。原先的相应步骤以及程序根本就不需要作任何改动。instsrv会自动地找到原先应该放在system32下的程序,而这个程序现在被放置在了SysWow64目录下。

简单一点的解决方法就是,将instsrv和srvany程序在windows/sysWow64目录下再copy一份,相当于在system32和sysWow64下都有程序,这样问题即解决。更底层的原因,也许只有微软能解释了,简而言之,在64位系统下,32位程序是看不到放置在system32下面的程序的,而它应该访问的system32目录被系统映射到了sysWow64目录下了,在运行时系统会自动地将相应的sysWow64目录映射为程序所认为的system32。
参考文档:http://en.wikipedia.org/wiki/WoW64