All Questions

Tagged with
Filter by
Sorted by
Tagged with
0
votes
2answers
26 views

C Serial Communication. WriteFile succeeds but my device only processes 1st character

I'm trying to implement serial communication with a hardware device that plugs into the USB port on my PC. Im writing the communication code in C using Visual Studio 2015. I'm using a USB sniffer to ...
-2
votes
0answers
57 views

Can't include `dbghelp.h` while compiling on Windows [duplicate]

I'm writing a C application on Windows 7, and it uses the Windows C API. [Edit] I'm using Mingw. I have no problems including <windows.h> and using WinAPI functions. However, I would like to ...
1
vote
1answer
36 views

How do I link dynamically built cmake files on Windows?

I have been struggling for the last 8 hours to find information on how to reference a library in a C project on Windows built with CMake, specifically cURL. I have downloaded version 7.67 cURL source ...
2
votes
1answer
21 views

How do I open the COM port specified by user?

I am trying to open the COM port that is given by the user input. I have tried the following code and the error message "Error in opening serial port" is printed. int main() { BOOL Status; ...
-1
votes
0answers
25 views

select() always recieves nothing from socket

I have following code: void receiveMessage(SOCKET *left_sock,SOCKET *right_sock, struct sockaddr_in left_addr, struct sockaddr_in right_addr) char message[BUFLEN]; int rcv; FD_SET ReadSet; SOCKET ...
1
vote
2answers
69 views

Is there a way I can pass another parameter to use inside this window callback function?

LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) So, this is the function prototype for a Window Procedure of some window created using the Windows API (win32). It is ...
-6
votes
0answers
52 views

How do I change a function behaviour in another process [on hold]

This is a two in one question. Imagine that I have a procedure, lets say void computeTakenDamage(Character *ch, float damage). Main question: What I would like to do is to change this function ...
0
votes
2answers
35 views

How can I handle _popen() errors in C?

Good morning; Right now, I'm writing a program which makes a Montecarlo simulation of a physical process and then pipes the data generated to gnuplot to plot a graphical representation. The simulation ...
0
votes
1answer
38 views

Windows function “NetUserChangePassword” is no longer working under Windows 10 (worked under Windows 7)

I am using the following code sample from the MSDN page to change the network password of a user (https://docs.microsoft.com/en-us/windows/win32/api/lmaccess/nf-lmaccess-netuserchangepassword): #...
1
vote
0answers
19 views

Can't set uri property of playbin created with gst_element_factory_make

I've been trying to put a video in the background of a GTK3 application's login screen for some time, without success. I tried following the Basic Tutorial 5 (using version 1.16.1.0 of gstreamer) ...
5
votes
0answers
49 views

Executing assembly code in memory using python modules ctypes and mmap

This code works on linux and prints 43, how could I code a script with similar functionality to be run on windows without errors? import ctypes import mmap buf = mmap.mmap(-1, mmap.PAGESIZE, prot=...
1
vote
1answer
40 views

Why console cannot catch mouse event after using function system()?

When I use the function system(), I cannot catch any mouse event. I have already know system() function is a shell command, but why using this command will block catching mouse event? #include <...
-2
votes
1answer
57 views

How to monitor changes to Windows desktop Items?

I am replacing the Windows desktop,but I don't know how to monitor changes to desktop items. please give me some ideas.I hope receive notifications when the following happens: the desktop icon is ...
2
votes
2answers
47 views

FILE vs HANDLE - what is the difference between these two things

So, I'm running on Windows and need to figure out the size of a file. SO mentions GetFileSize in many places, which takes a HANDLE. I'm used to just working with FILEs returned from fopen and such. ...
0
votes
1answer
18 views

How can my pipe client wait for the server

I am implementing a named pipe IPC scheme in C running on windows, which is mostly working. On the client side I create the pipe like this void CreatePipex(const LPCWSTR pipename, InteruptHandler ...
0
votes
0answers
19 views

symlink() creating .system file instead of .symlink file in windows

This case is used for the mix of windows and UNIX based os's. When used symlink() its works fine for UNIX/Linux but when same applied on windows instead of a symbolic link file .system file gets ...
0
votes
1answer
24 views

Read raw data from USBPcap library

I am using USBPcap to capture transferred data between USB device drive and OS but it will save the data in .pcap file which just can be read by Wireshark it self. I go into USBPcap source code but ...
-3
votes
1answer
25 views

Read and Write PCI BAR0 register in windows

I need a test application which can Read and Write PCI BAR0 register in windows. Input: offset, length I have tried in Linux and its working but i want to write in windows.
0
votes
2answers
68 views

Password in star form

i want this password code in star form. anyone can help. /*password*/ LOGINP: clrscr(); printf("\n\n\n\n\nUsername: its_vishuuuu"); gotoxy(x,y); printf("Login\n\n\t\t\...
0
votes
1answer
54 views

WinAPI - How to redirect all stdout of a program and external DLLs to the Win32 standard output handle?

I want to be able to redirect all standard output of a Windows application to the Win32 standard output handle, instead of using a console handle. For context, the Emacs Win32 FAQ says this: ...
0
votes
0answers
66 views

How can I make USB-to-Serial adapter faster, ReadFile taking too long to execute

I am trying to communicate with an Arduino every 1ms. Arduino is doing just fine at sending commands but my PC wont read data every 1ms. It usually takes 3 - 4ms and by that time my Arduino has ...
0
votes
1answer
31 views

Passing arguments to a running file via cmd with c

i'm making a program in C that controls a a spigot server .jar that works with cmd. I start this program with a system('call to .bat file') call to a .bat file and the program start succesfully. To ...
0
votes
0answers
38 views

Windows dlls for PE (x86)

I have a code sample that uses the following headers: #include <stdio.h> #include <string.h> #include <stdlib.h> I want to use dlls in order to use some functions from those ...
-1
votes
0answers
51 views

get modifier's PID, when registry modified using winapi

I am trying to get those process information (including PID, Name, Path, etc) who are trying to modify the windows registry. for this, I wrote a win32 program which having CreateEvent() call for event ...
0
votes
0answers
47 views

Is there en existing C/C++ extension for Python implementing a System wide file search on Windows

Let's say I want to provide an alternative for the Windows Search field (the one that opens when you press the Windows Key and start typing). The goal would be to have an Input field, where I type in ...
0
votes
0answers
38 views

How to subscribe to port opening or port closing events in C?

I found out that you can use GetTcpTable2 to find out all TCP connection statuses. Unfortunately it takes 100ms to cycle through the array returned by GetTcpTable2(see example on the upper link). This ...
-1
votes
0answers
40 views

Trouble opening text files in C program

I have searched and tried troubleshooting this problem for a while now but still can't make it seem to work. The program is not opening 2 files I have saved to my desktop and the program just ends ...
0
votes
1answer
25 views

Send Raw arp reply packet in windows

I am currently learning how to use the windows raw sockets. I created a raw arp reply frame(includes all headers (ethernet+arp headers)), and when I send it using sendto function, It fails and return ...
-3
votes
0answers
37 views

how can I redirect the text file in command prompt

I want to create an executable program from my C code that can take the values from a text document and use it. Can you say that from beginning what I need to do?
4
votes
0answers
60 views

Not being able to get backspace character (\b) in the output

#include <stdio.h> main() { int c; while ((c = getchar()) != EOF) { if (c == '\t') { putchar('\\'); putchar('t'); } if (c == '\b') { ...
0
votes
0answers
28 views

POSIX/MinGW compatibility: mkdir('/tmp/randompath') fails

I need to create temporary folder in C/C++ library, and make it compatible with Windows/MinGW. While mkdir("/tmp/something") works well (with permissions parameter of course) under Linux/macOS/...
-3
votes
1answer
111 views

Why heap memory still accessible after HeapFree

I wrote a simple C program which creates a singly linked list. It works; for instance, I pushed a few numbers to a list and the function print_list(...) prints the numbers to the console. However, I ...
0
votes
0answers
24 views

MSYS2 on Windows 10 With Glade ( gtk_entry_get_text: assertion 'GTK_IS_ENTRY (entry)' failed )

Unfortunately I'm new to programming in C and I'm experiencing many problems with external libraries compatibility between linux and windows. I'm trying to learn how to use GTK 3, use Glade to create ...
0
votes
1answer
44 views

How can I get current microphone input level with C WinAPI?

Using Windows API, I want to implement something like following: i.e. Getting current microphone input level. I am not allowed to use external audio libraries, but I can use Windows libraries. So I ...
0
votes
0answers
75 views

Should I use GetFileSize or _stat64 to get a file size on Windows?

In order to reliably get the size of a file on Windows, I have found two solutions on SO: GetFileSize or _stat64. What are the pros and cons for each one?
0
votes
0answers
23 views

How to compile C mysql programs in Windows using minGW

I'm attempting to compile a C program on Windows cmd with minGW but I keep getting the error message db_test.c:1:10: fatal error: my_global.h: No such file or directory and I don't know how to fix ...
-1
votes
1answer
70 views

Custom WM_APP message isn't posted in the message queue

I am trying to send a custom message (WM_APP + 1) when WM_SIZE is send to the window procedure. I want to be able to catch it from an other function using PeekMessage and do somethings. But when I ...
0
votes
1answer
44 views

Writing a txt file while running some calculations

I am trying to create a program that outputs in a txt file the results of Collatz conjecture. However when I try to do it with big numbers, like 1,000,000, it does not work properly and always stops ...
4
votes
0answers
70 views

Malloc occasionally returns null on Win64

Disclaimer: I tag the question as both C and C++ as I use std::malloc in a C++ project. My C++ application allocates/deallocates some memory repeatedly. In most cases I use new/delete, but in some of ...
0
votes
1answer
23 views

Crashes when trying to generate multiples of the same process(Access Violation Error)

So, when trying to create multiple processes of the same program I am getting an access violation error when I try to create the second child process. (I am able to create one child process before it ...
9
votes
5answers
170 views

Dynamic linking - Linux Vs. Windows

Under Windows, when I compile C/C++ code in a DLL project in MSVC I am getting 2 files: MyDll.dll MyDll.lib where as far as I understand MyDll.lib contains some kind of pointers table indicating ...
0
votes
0answers
15 views

GetSystemMetrics() reporting wrong mouse value on RDP session

If I call the Windows GetSystemMetrics() function to learn about the number of buttons of the installed mouse but it always returns 2 if the function is called from a Remote Desktop session. My ...
2
votes
3answers
82 views

How does cmd.exe display stdout even though the process doesn't flush?

I used this MSDN code to hook stdout and stderr for a child process, (except that I'm calling PeekNamedPipe first so that I don't block) and all is well except that for stdout if the process doesn't ...
0
votes
1answer
59 views

POSIX C wrapper for win32, linux, mac

Can someone suggest a lightweight C library/header wrapper for POSIX functions that can be used cross-platform? For example, it could be as simple as mapping open and close which are _open and ...
0
votes
1answer
62 views

Getting absurd times for thread creation in Windows when using CreateThread()

So I have created following simple program to measure the average time to create a process or thread on my machine: #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #...
0
votes
1answer
47 views

Build Apache APR 1.7 with Visual Studio (2017), IF_NAMESIZE undefined

Trying to build apr 1.7 on Windows with Visual Studio, tried 2017 and 2013. When building the project (Debug|x86) or compiling e.g. dso.c if get the following error message: 1>dso.c 1>c:\dev\...
1
vote
1answer
47 views

PfCreateInterface returns error 120 (not implemented)

I need to create a simple IP filtering program for Windows; however, I am having problems getting the relevant API call to work. Below is a small example demonstrating how PfCreateInterface fails. It ...
0
votes
1answer
32 views

Adding Date string to beginning of filename in C, WINAPI

I'm trying to add a date string to the beginning of my filename and I can't see why this isn't working. I have a function which grabs the date and time and turns it into a string format, then I have a ...
-1
votes
0answers
26 views

SIGSEV signal recieved printing a result in C with the MySQL API

I'm developing an interface for an airport which is supposed to check-in people on a flight, generate a boarding-pass etc for a university course. I decided to use the MySQL API that I included in my ...
1
vote
1answer
217 views

File operation error on windows network drives

Recently I have problems with low-level file oprations (in old legacy code) fd = open(file, O_RDWR); ... lseek(fd, 0L, SEEK_END); write(fd, buffer, len); ... lseek(fd, pos, SEEK_SET); read(fd, buffer,...