systems-programming

System wide right click context hook

£可爱£侵袭症+ 提交于 2019-12-11 08:57:27
问题 **Hello.. i am creating English To Gujarati Dictionary WinForm Application. I need to set a system wide hook to the right click context menu on for text selection. it means when this application is running,and if user selects word from any program and right click on it gujarati meaning of that word should be displayed as menu item. How to do this? or any other options like Registery Programming,shell extentions etc...? i have to do this,even if you say its not possible. so please help me.**

contiguously space on hard disk - NTFS

六眼飞鱼酱① 提交于 2019-12-11 02:16:33
问题 My question is about file allocation methods on NTFS Fs. I have two main questions - When i create a file on NTFS, is it stored contiguously on the physical hard disk? if not - is there a way to create a file such that when i write to it the data is stored contiguously (on the hard disk) in it? Something like extents in database. if such a file exists - is there any way to read data from it (using C read system call) in bunch/block. what is the maximum bunch size I can use. I am trying to

Boost Thread Specific Storage Question (boost/thread/tss.hpp)

一世执手 提交于 2019-12-10 22:02:13
问题 The boost threading library has an abstraction for thread specific (local) storage. I have skimmed over the source code and it seems that the TSS functionality can be used in an application with any existing thread regardless of weather it was created from boost::thread --i.e., this implies that certain callbacks are registered with the kernel to hook in a callback function that may call the destructor of any TSS objects when the thread or process is going out of scope. I have found these

Programmatically restart USB device in Windows

吃可爱长大的小学妹 提交于 2019-12-10 15:33:37
问题 Some software I am developing requires the presence of a USB device (which I interact with as a SerialPort, with a USB-to-UART bridge). Sometimes, after a computer is being restarted from hibernation, the device is not being detected, and I can no longer write to, or read from, the device through its serial port. Having read/write access to the device is necessary. I cannot rely on the user to take any action (physical or otherwise), so I need a way to restart the device programmatically. How

Want to know Windows Clipboard Internals

♀尐吖头ヾ 提交于 2019-12-09 18:36:03
问题 I am interested in learning windows system internals and how things work. I am inclined towards learning system programming on windows. With that context, I am curious to know few things on how windows clipboard internally functions: What precisely happens when we select some text, image etc and press Ctrl + C ? What precisely happens when we we press Ctrl + V in different application? Where exactly the copied data resides? Does the copied data go into kernel mode memory - that is shared

How to get information from device manager?

牧云@^-^@ 提交于 2019-12-08 21:43:32
问题 How can I, in my C# applictation, read specific information about a device? I have tried WMI and it does not provide the information that I need. The information that I want is stored in the Details tab of a device and the information I want there is "Parent". I have also looked in regedit, without any luck. 回答1: Microsoft provides a sample: http://support.microsoft.com/kb/311272 From C#, it might be easier to capture the output of devcon than integrating the APIs. If you feel comfortable

How can I know the service name?

此生再无相见时 提交于 2019-12-08 15:18:30
This code from Stevens et al., Advanced Programming in the Unix Environment, Figure 16.17 is a server program to provide system uptime : #include "apue.h" #include <netdb.h> #include <errno.h> #include <syslog.h> #include <sys/socket.h> #define BUFLEN 128 #define QLEN 10 #ifndef HOST_NAME_MAX #define HOST_NAME_MAX 256 #endif extern int initserver(int, const struct sockaddr *, socklen_t, int); void serve(int socked); int main(int argc, char *argv[]) { struct addrinfo *ailist, *aip; struct addrinfo hint; int sockfd, err, n; char *host; if (argc != 1) err_quit("usage: ruptimed"); if ((n = sysconf

Find which page an address belongs to

我的梦境 提交于 2019-12-08 04:36:16
问题 I could find out the address of a buffer in memory trivially as follows :- int main() { char buffer[100]; printf("%p\n, buffer); } Is there any way I could print out the address of the page the buffer belongs to? [EDIT] I'm on a Linux machine, Ubuntu to be exact. I'm curious about both 32 and 64 bit versions. 回答1: There seems to be no system call provided by the Linux where we can get such information. However I think we can get the information(/proc directory) by following steps: Get the

Initialize array in c in the format `int a[3]={0,};` [duplicate]

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-08 03:22:03
问题 This question already has answers here : Array initialization C (5 answers) Closed 3 years ago . I had seen a source where array initialize in int arr[3] ={0,}; What does it mean ? I normally use this format int arr[3]={0}; can i know what is the difference 回答1: This is probably a dup, but I'll take a shot anyhow. There is no difference between int arr[3] ={0,}; and int arr[3] ={0}; . Ref: C11 6.7.9: initializer: assignment-expression { initializer-list } { initializer-list , } Both forms of

when using different file descripter, why is the result different? (system programming)

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 00:52:23
问题 I am studying about file descripter and realized that if I use dup2() function, the result will be different. The first snippet ... int main(void){ char buf1[BUFSIZ] = "I am low\n"; printf("i am high\n"); write(1, buf1, strlen(buf1)); write(1, buf1, strlen(buf1)); write(1, buf1, strlen(buf1)); return 0; } ... produces the following result: i am high i am low i am low i am low But the second snippet ... int main(void){ int fd = open("dupout",O_CREAT | O_WRONLY, 0655); char buf1[BUFSIZ] = "I am