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.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have seen a few sample of running .exe file in a Qt program but is it possible to invoke the functions in the external program?
For example, external program A is an existing application which receives input and generates output. Program A requires the users' interaction with the GUI of Program A in order to work. How do I pass the input to program A and get output for my current Qt program without showing and using the GUI of Program A.
actually you can and this is knonw in the it world as IPC
every Operating Sytem has some interfaces to allow you to do that and qt has some concrete implementations of these. (https://doc.qt.io/qt-5/ipc.html)
Inter-Process Communication in Qt
TCP/IP
Local Server/Socket
Shared Memory
D-Bus protocol
QProcess Class
Session Management
but this is not going to work out of the box, you need to "enable" such capabilities in your qt app and the 3rd app triggering the methods must be:
able to call IPC interfaces,
able to know what interfaces are exposed by your qt app (what is the signature of the method etc etc)
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.
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
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.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I need something a little more feature rich than Sysinternals TCPView (which I regularly use) ... but it also must be freeware. :)
Well, the question is a bit old and I realize that probably you already found the software you were looking for... just in case, an interesting connection monitor utility is CurrPorts, by Nir Sofer.
Freely adapted from the program's home page:
displays the list of all currently opened TCP/IP and UDP ports on your local computer;
for each port in the list, information about the process that opened the port is also displayed, including the process name, full path of the process, version information of the process (product name, file description, and so on), the time that the process was created, and the user that created it;
allows you to close unwanted TCP connections, and kill the process that opened the ports;
allows custom filters for inclusion/exclusion of connections.
Maybe a full blown traffic sniffer like Wireshark will complement your tool set?
Amongst wiresharks features are:
packet analysis
traffic statistics
capture
coloring
data export
I recommend TCPView for Windows v2.53.
image http://i.technet.microsoft.com/bb897437.TcpView(en-us,MSDN.10).gif
TCPView is a Windows program that will show you detailed listings of all TCP and UDP endpoints on your system, including the local and remote addresses and state of TCP connections. On Windows Server 2008, Vista, NT, 2000 and XP TCPView also reports the name of the process that owns the endpoint. TCPView provides a more informative and conveniently presented subset of the Netstat program that ships with Windows. The TCPView download includes Tcpvcon, a command-line version with the same functionality.
Not sure what features you are looking for so this is my suggestion.
Without having used it, I have seen TCPStat advertised a few times.
It looks like it was a discontinued project somewhere around 2003 and it's an awful blue color.
There's the MS Network Monitor.
Process Hacker shows also send/receive bytes, speed, country flag etc.