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

推荐订阅源

博客园 - Franky
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Schneier on Security
Know Your Adversary
Know Your Adversary
Security Latest
Security Latest
Spread Privacy
Spread Privacy
Project Zero
Project Zero
T
The Exploit Database - CXSecurity.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
AI
AI
N
News | PayPal Newsroom
A
Arctic Wolf
NISL@THU
NISL@THU
W
WeLiveSecurity
Security Archives - TechRepublic
Security Archives - TechRepublic
Hacker News: Ask HN
Hacker News: Ask HN
P
Palo Alto Networks Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
大猫的无限游戏
大猫的无限游戏
L
Lohrmann on Cybersecurity
Last Week in AI
Last Week in AI
T
Threatpost
The Last Watchdog
The Last Watchdog
博客园_首页
C
Cybersecurity and Infrastructure Security Agency CISA
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
Engineering at Meta
Engineering at Meta
爱范儿
爱范儿
aimingoo的专栏
aimingoo的专栏
S
Security Affairs
P
Privacy & Cybersecurity Law Blog
B
Blog RSS Feed
AWS News Blog
AWS News Blog
P
Proofpoint News Feed
雷峰网
雷峰网
T
Tenable Blog
Schneier on Security
Schneier on Security
H
Heimdal Security Blog
V2EX - 技术
V2EX - 技术
V
V2EX
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
Secure Thoughts
Latest news
Latest news
Help Net Security
Help Net Security
Jina AI
Jina AI
Stack Overflow Blog
Stack Overflow Blog
The Cloudflare Blog
V
Vulnerabilities – Threatpost
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org

博客园 - 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