Windows Services & Other Stuff

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
RichAlgeni
Addict
Addict
Posts: 914
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: Services, Stuff, and Shellhook

Post by RichAlgeni »

I will do so! Thanks for the heads up!!
User avatar
RichAlgeni
Addict
Addict
Posts: 914
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: Services, Stuff, and Shellhook

Post by RichAlgeni »

Looks like the InflateDeflate link is going to your hide video source?
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Services, Stuff, and Shellhook

Post by JHPJHP »

Hi RichAlgeni,

Sorry about that, there were a few downloads with the links crossed. I have tested and confirmed that all the links now point to the correct package.

Thank you for letting me know.
User avatar
RichAlgeni
Addict
Addict
Posts: 914
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: Services, Stuff, and Shellhook

Post by RichAlgeni »

Thanks!
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Services, Stuff & Shellhook

Post by JHPJHP »

Updated:
- Stuff\ISAPI\...

TESTED:
- Windows 10
- PureBasic 5.61 (x86 / x64)

This example was added after reading this thread: http://www.purebasic.fr/english/viewtop ... 13&t=69661

The Include file was written from scratch, but the example was based on the following work by freak: http://www.purebasic.fr/english/viewtop ... 12&t=57127
freak wrote:1.Install IIS using Control Panel -> Programs and Features -> Turn Windows features on or off
2.Make sure at least the following components are selected:
◦Internet Information Services
◦Internet Information Services -> Web Management Tools -> IIS Management Console
◦Internet Information Services -> World Wide Web Services Application Development Features -> ISAPI Extensions

3.After the installation, type "localhost" in your browser. A page with the IIS logo should come up if IIS is installed
4.Compile the example to a dll and place it in "C:\inetpub\wwwroot\IsapiExample.dll".
◦Note that you probably cannot compile directly to the folder due to permissions, so compile somewhere else and then move the file there with explorer.
◦If your system is 64bit, you should compile the dll using PBx64. You can run 32bit ISAPI extensions, but it requires extra configuration and I did not actually try that.

5.Open "Internet Information Services (IIS) Manager" from the Startmenu
6.Select the root of the tree on the left and then open "Handler Mappings" in the main view
7.Select the entry named "isapi-dll", right-click and select "Edit..."
8.In the "Executable" field, enter "C:\inetpub\wwwroot\IsapiExample.dll"
9.Click "Request Restrictions" and on the "Access" tab make sure "Execute" is selected. Hit ok on the second dialog.
10.Hit ok on the first dialog. A requester is shown asking if you want to allow the extension. Click "Yes".
◦What this does is create an entry under "ISAPI and CGI restrictions" on the main page. You can also add an entry there manually or later allow/deny an extension there

11.In your browser, open "http://localhost/IsapiExample.dll". If all worked right, you should see the example page generated by the dll.
Last edited by JHPJHP on Fri Dec 01, 2017 1:38 am, edited 2 times in total.
swhite
Enthusiast
Enthusiast
Posts: 726
Joined: Thu May 21, 2009 6:56 pm

Re: Services, Stuff & Shellhook

Post by swhite »

Hi

I am using a script map (*.dcpay) to load my dll. It does not matter what you use for a script map as long as it is unique. The URL can be anything you want as long as the action ends with the script map. So in my case I called the action dcpayment.dcpay. The important part is the .dcpay which is mapped to my dll in IIS.

In IIS I enabled the script map for the default site under Handler Mappings and I added a new script map and set the access to "execute". I also removed the restriction under mappings that ties the request to a physical file (i.e. dcpayment.dcpay does not need to exist for the request to run).

Perhaps this might be helpful to support multiple ISAPI extensions.

Simon
Simon White
dCipher Computing
User avatar
RichAlgeni
Addict
Addict
Posts: 914
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: Services, Stuff & Shellhook

Post by RichAlgeni »

To handle multiple extensions, I created an 'isapi' directory, then sub-directories for each handler.

One more note, Windows 2012r2 is so much better at handling changes in IIS Manager. I had numerous issues when I changed handlers in Windows 2008. To the point where IIS would no longer recognize handler mappings, even after I uninstalled and reinstalled IIS.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Windows Services & Other Stuff

Post by JHPJHP »

Updated:
- Other_Stuff\OtherStuff\SetWindowsHookEx\
-- binaries\SetWindowsHookEx_32.dll, SetWindowsHookEx_64.dll
-- SetWindowsHookEx.pb, SetWindowsHookEx_DLL.pb
- RegisterShellHookWindow.pb

SetWindowsHookEx.pb:
- if the window you want to effect was created from a 32 bit process, execute this file from PureBasic x86
- if the window you want to effect was created from a 64 bit process, execute this file from PureBasic x64

RegisterShellHookWindow.pb:
- not effected by the process the window was created in

While performing cursory tests in Windows 10, I observed the following while opening a variety of applications:
- File Explorer moved to the set position before the Window was visible
- UltraEdit moved to the set position after the Window was visible
- Calculator did not respond to the SetWindowPos Function

NB*: Replace "File Explorer" in the CallWndProc / WindowProc Procedure to suit your needs.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Windows Services & Other Stuff

Post by JHPJHP »

Updated:
- various examples and optimizations

Since my last post to this thread there have been numerous additions and improvements to existing examples.

Added Today:
- \Other_Stuff\MonitorStuff\
-- ScaleFactor.pb, SetDpiAwareness.pb, WindowsDpiStuff.pb

NB*: Most of the new additions and improvements can be found peppered throughout my other downloads.
User avatar
oreopa
Enthusiast
Enthusiast
Posts: 281
Joined: Sat Jun 24, 2006 3:29 am
Location: Edinburgh, Scotland.

Re: Windows Services & Other Stuff

Post by oreopa »

Thanx for all your stuff. I found #WM_COPYDATA example very helpful. Appreciate it.
Proud supporter of PB! * Musician * C64/6502 Freak
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Windows Services & Other Stuff

Post by JHPJHP »

Hi oreopa,

Thank you for posting. It is nice to hear the work I have done is appreciated.

NB*: Since my last post to this thread there have been numerous additions and improvements to existing examples.
User avatar
RichAlgeni
Addict
Addict
Posts: 914
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: Windows Services & Other Stuff

Post by RichAlgeni »

Is that your real picture JHPJHP???
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Windows Services & Other Stuff

Post by JHPJHP »

Hi RichAlgeni,

Are you referring to my avatar :?:

Image

NB*: Drag & Drop my avatar onto Google image search: https://www.google.com/imghp?hl=EN
User avatar
RichAlgeni
Addict
Addict
Posts: 914
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: Windows Services & Other Stuff

Post by RichAlgeni »

:lol:
Wolf
Enthusiast
Enthusiast
Posts: 228
Joined: Sat Apr 03, 2004 12:00 pm
Location: S.T

Re: Windows Services & Other Stuff

Post by Wolf »

Many thanks @JHPJHP for your great codes especially "CopyData" and "ShareMemory"
I tested "CopyData" with big unicode text and it worked great :wink:
Locked