Use the gd extension to call imagegrabscreen to take a screenshot, and the screen is completely black! Allowing services to interact with the desktop is useless!

WBOY
Release: 2016-07-28 08:26:23
Original
1203 people have browsed it

Use gd extension to call imagegrabscreen to take a screenshot, the screen is completely black! ! ! The circulated method "Allow services to interact with the desktop" does not work at all! ! And the weirdest thing is that when I try to use system to call an exe written in C to take a screenshot, the screen is black, but directly calling this exe from the command line to take a screenshot has no problem at all! Find the solution! ! !

Okay. . It seems that I can only ask and answer myself...

It is a problem of session0 isolation
As long as httpd.exe does not run as a system service, the headache of session0 can be bypassed.

The day after this question was posted, I tested it on XP and found that as long as I checked it, there would be no problem. The screen is still black on my win7 and winserver2012. I tried to log in to the service with my usual account, but it didn't work. Then I turned my attention to the user/group option on httpd.conf, changed deamon to apache, and changed various user/groups, but none of them worked. At this time, I thought of running the service in session 0 on systems above Win Vista and isolating it from the user interface. Even if "Allow service to interact with desktop" is checked, the captured screen is the content of session 0. It just so happens that the content on the desktop of session 0 is empty, and the wallpaper is also black... so the "black screen". What's even more fatal is that if you want to shell, the permissions are extremely low. I even tried using lsrunas and saunr (runas requires a password) to run the screenshot exe with elevated privileges, but win7 has blocked this backdoor. Just when I was about to give up, my classmate tested on Win7, and he installed xampp. It actually works. I find it incredible. Finally found that there is no apache service on his computer! ! So I found the answer: as long as httpd.exe is not run directly as a service, the headache of session0 can be bypassed.

For the issue of session 0 isolation, please see this article, which is more clear: http://www.cnblogs.com/gnielee/archive/2010/04/07/session0-isolation-part1.html


The above introduces how to use the gd extension to call imagegrabscreen to take a screenshot, and the screen is completely black! Allowing services to interact with the desktop is useless! , including relevant content, I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!