C++ Windows API Syscall Hook Example [closed] - c++

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Im just starting to learn C++ programming and for exercise I want to learn how to write Windows API Syscall Hook. For example, if I will try to delete a file with a specific name, for exmaple 'test.txt', then instead of deleting it a message would pop up. I tried searching for a tutorial on how to do something like that but I couldn't find anything.
Maybe someone could share a link to a tutorial on how to do something like this or maybe a very simple code example?
I am working on Windows 10 machine and Visual Studio 2015.

Write a File System (Mini-)Filter Driver.
https://msdn.microsoft.com/en-us/library/windows/hardware/ff548202%28v=vs.85%29.aspx
A file system filter driver is an optional driver that adds value to
or modifies the behavior of a file system. A file system filter driver
is a kernel-mode component that runs as part of the Windows executive.
A file system filter driver can filter I/O operations for one or more
file systems or file system volumes. Depending on the nature of the
driver, filter can mean log, observe, modify, or even prevent. Typical
applications for file system filter drivers include antivirus
utilities, encryption programs, and hierarchical storage management
systems.
The windows driver samples contain a minifilter driver to detect deletions of files or streams.
See: https://github.com/Microsoft/Windows-driver-samples/tree/master/filesys/miniFilter/delete

Related

Wireless API for Linux in C\C++ [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm trying to find a proper way how to reuse existing implementations of wifi tools(iw) in own code(c\c++). I need to get information about available AccessPoints in range(signal strength, mac addr., etc). I found couple example codes(WEXT and others) that uses ioctl approach, but it makes passive scans(and i get new information only once in two minutes in my network)[UPDATE1: Thanks to #fluter, i know that WEXT can do active scanning, too.]. I found that iw makes an active scan and that is what i need. So my question:
Is there a way to use iw code in my own app without parsing its source code in chunks, or, maybe, there is an Wireless API for such purpose?
(UPDATE1: with basic code examples to start with.)
Similar question
UPDATE2: I have reviewed my task and found that AP information is not enough for me, i need to capture clients data, too. That leads me to wifi packet sniffing and the best tool i have found to do that is Horst. So, i'm trying to reuse its code in my app, now.
You might wish to start with cfg80211.
cfg80211 replaces Wireless-Extensions and it is suggested that :
All new Linux wireless drivers should be written targeting either cfg80211 for fullmac devices or mac80211 for softmac devices.
Also, it is written:
Instead of writing wext ioctls you now write cfg80211 operation
callbacks and fill in the wiphy struct to indicate to cfg80211 its
device capabilities.
To start with active scanning start here
You can use the wext api provided by kernel, basically, call ioctl with SIOCSIWSCAN, and get the scanned result with SIOCGIWSCAN.
You can set to scan all by using flag IW_SCAN_ALL_ESSID, and choose scan type with flag IW_SCAN_TYPE_ACTIVE or IW_SCAN_TYPE_PASSIVE.

c++ debug logging on windows [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I am curious as to what is the most common and/or accepted way of logging debug print info for a c++ win32 application on Windows. I am not using visual studio, and am compiling with GCC.
I am used to developing on Android, and writing and monitoring logs using logcat.
Is there something like this for win32?
EDIT:
Is it most common to use something like this?
https://msdn.microsoft.com/en-us/library/6xkxyz08.aspx
Although it does not provide the added functionality of filtering and daily / size rollover OutputDebugString is a good API that allows you to send debug logging messages.
The output can be retrieved and displayed with a special program, when the program is not started the output simply gets ignored.
Read more about it in this article: How to view output of OutputDebugString? (the same API call can be used from C++)
Depending on the size of the output you might want to use Eventlog of Windows or a logging framework like
http://log4cpp.sourceforge.net/
The standard infrastructure for logging in Windows is Event Tracing. It is available (and used) in all parts of the OS, both by user mode applications and kernel mode modules:
Purpose
Event Tracing for Windows (ETW) provides application programmers the ability to start and stop event tracing sessions, instrument an application to provide trace events, and consume trace events. Trace events contain an event header and provider-defined data that describes the current state of an application or operation. You can use the events to debug an application and perform capacity and performance analysis.
Where applicable
Use ETW when you want to instrument your application, log user or kernel events to a log file, and consume events from a log file or in real time.
Developer audience
ETW is designed for C and C++ developers who write user-mode applications.
Run-time requirements
ETW is included in Microsoft Windows 2000 and later.

How to capture audio from specific application and route to specific audio device in Windows 7? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
The community reviewed whether to reopen this question 6 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
Ok, my question is this:
How can I programmatically capture audio from a specific application and then send it to a specific audio device in Windows 7?
I know for a fact this can be done, since SoundLeech captures audio from individual programs, and theoretically once you have the sound you can do what you want with it (including play it to any sound output device).
I'm a C++ programmer but I know very little about Windows programming. I need some pointers to capturing sound from individual programs. I work with audio recording very frequently and I would be willing to put in a large amount of work to develop a way to better handle sound in Windows given how difficult to use it currently is.
So how can I capture audio streams directly from applications without first routing them through Virtual Audio Cables or the like?
You cannot do it using standard user mode APIs. You need to either hook APIs or create virtual devices to accept application streams/sessions.
Intercepting and postprocessing all audio streams on Windows
Recording Audio Output from a Specific Program on Windows
Is it possible to caputre the rendering audio session from another process?
Capture audio of a single application on Windows 7

Interactions with other application [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm a learning c++, I want to know that how programs are made that can interact with other application in windows.By interaction I mean like clicking a button, giving keyboard input, changing settings of that application, changing options or even editing or creating files.How can I make such Programs in C++?
How you interact with other applications depends on your OS. If e.g your application runs on windows you have to use the Win32 API. The Win32 API are functions provided by the OS allowing you to interact not just with other applications but also with the OS itself, e.g to set up windows or to open files.
Win32 provides a messaging system. Every application has a message loop and accepts messages from the OS (e.g about mouse clicks) but can also receive messsages from other applications. The receiver cant decide whether the message comes from the OS or from another process.
To e.g change the title, you have to send the other application a WM_SETTEXT message using the SendMessage function.
Directly interacting with another application (changing its values, not just modifying the GUI) is just possible, if the application provides some kind of interface. These could be a network connection, named pipes, shared memory or some module/plugin loading mechanism (through dlls). Otherwise its not possible (easily).
For UNIX based OS an API called POSIX exists providing similiar functionality as Win32.

Thermal printer Driver In windows [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am new to windows driver development, now i am developing Driver for our own thermal printer. So learn some Printer driver basics From MSDN (WDK source). Now i am printing with Generic TEXT/ONLY mode in windows .but i need to integrate my printer with different applications like (word ,pdf, and from browser)for that GENERIC/TEXT ONLY MODE will not help so i need to create a own driver.every printer driver must have
1.GPD
2.Printer graphics DLL.
3.Properties.DLL
i have some doubt about this.i found some dlls from WDK source
is it possible to use that dll for my printer .
Are those dll's printer specific.
how to make my printer support various printer command languages?
how to make my driver to work with multiple windows versions like xp
,7,8 ?
if you have any experience with printer driver development can you share your knowledge with me.
Your question is very broad. In essence, you're asking for an entire tutorial on print drivers, which could fill a book. Take a look at the Unidriver plugin samples in the WDK. A version 3 Unidriver plugin will work on any Windows platform from XP to Win8. If your printer is raster technology, you'll probably want to start with the BITMAP sample.