What is blocking driver installation in Windows? - c

I've written a C program in Windows that uses some precompiled files from WinDivert. My program uses a .dll from WinDivert and some of the functions in the .dll install the WinDivert.sys driver. There are also a few more files from WinDivert that are a part of this (a .lib, a .inf, and another .dll).
The problem is that on one of my computers (Windows 8.1 64 bit), everything works perfectly. But, when I try to use the program on my laptop (Windows 8.1 64), my friend's laptop (Windows 7 64), or another Windows 7 64 desktop, something blocks the installation of the driver. I'm unsure what is blocking it or how to stop it from being blocked because on all computers:
+I'm running on an admin profile
+Running the program in admin command prompt
+Tried disabling firewall, anti virus, etc (although it runs fine with these on for the computer that works)
+As far as I can tell, all my security settings are the same
+Note: the driver does have a valid signature.
Why does the driver install perfectly on one computer, but not on the other three? What could be issue?

The main causes for 1275 errors are documented on the WinDivert FAQ. However, there may be other causes that I'm unaware of (perhaps some experts out there can help?)
Another thing to try is the following commands:
sc stop WinDivert1.1
sc delete WinDivert1.1

Related

How to synchronize code files on windows with WSL/linux?

Basically I have some C/C++ code that I need to build and debug on a Linux machine. Unfortunately, my windows laptop doesn't have enough free hard space to install some Linux dist nor does it have enough free RAM to comfortably run VM.
Until now, I dealt with it rather comfortably using WSL, but the scale was rather small. It was easy to edit and debug 2-3 .c files through CLI and gdb, but it became really annoying on a large scale projects.
I want something simple as "edit code in windows IDE [X], compile it on remote Linux/WSL (the project uses Makefiles), and preferably debug it via gdb".
VS has something close to what I want, but it can't deal with existing Linux projects. It needs to create a new configuration which is alien to the project's Makefile.
I know this question is a bit old, but I think the solution is to make a symlink between your WSL folder and the Window's folder. This is how I handled it for a Ubuntu-20.04 WSL:
Access PowerShell in Administrator mode
Type cmd.exe in the PowerShell
Once cmd.exe is opened, type mklink /d C:\<path_to_your_Windows_folder> \\wsl$\Ubuntu-20.04\home\<your_user>\<path_to_your_WSL_folder>
EDIT
This was tested under Windows 10 Version 2004 with WSL2
I'm unsure about C and C++ but it sounds like this is exactly the same as how i work in node and javascript every day.
I checkout my code using git inside WSL to a location like /mnt/c/code/myproject. Then using sublime/VS code/webstorm i edit the files in windows in the location c:\code\myproject this works really well and have been doing this every day for over a year.
Things to be aware of are that you need to ensure that your editor of choice saves files with linux line endings and that all command line operations are done inside WSL.
Please see this article to see the differences between windows and linux files and how this works inside the WSL.
I want something simple as "edit code in windows IDE , compile it on remote linux/WSL
You will have something as simple as that.
Only with Windows 19.03 though:
See "Updated WSL in Windows 10 version 1903 lets you access Linux files from Windows"
Microsoft's Craig Loewen says:
In the past, creating and changing Linux files from Windows resulted in losing files or corrupting data. Making this possible has been a highly requested and long anticipated feature. We're proud to announce you can now easily access all the files in your Linux distros from Windows.
So how does this work? He goes on to explain:
To put it briefly: a 9P protocol file server facilitates file related requests, with Windows acting as the client.
We've modified the WSL init daemon to include a 9P server. This server contains protocols that support Linux metadata, including permissions.
There is a Windows service and driver that acts as the client and talks to the 9P server (which is running inside of a WSL instance).
Client and server communicate over AF_UNIX sockets, since WSL allows interop between a Windows application and a Linux application using AF_UNIX as described in this post.
Warning:
The old rules still apply, you should NOT access your Linux files inside of the AppData folder!
If you try to access your Linux files through your AppData folder, you are bypassing using the 9P server, which means that you will not have access to your Linux files, and you could possibly corrupt your Linux distro.

A machine gets frozen when installing a LWF driver

everyone. I am developing the LWF version WinPcap. It is already finished and under internal test currently. A colleague shared a Win7 x64 virtual machine with me remotely. Then I tried to install my new WinPcap installer on it and the machine just got frozen when installing the driver. The strange thing is that only this machine has this problem. I tested my own Win7 x86/x64 and Win8 x86/x64, no this issue.
I seem to encounter an alike problem before, but it is a debug version. My machine got recovered when a kernel debugger like WinDbg or VS2012 was attached. I thought this is a "int 3" problem. But the driver in this installer is a release version. So I don't know if this is because of the same issue. It is difficult to attach that remote machine becasue we are from different countries.
Also this should not be a deadlock issue like NdisWaitEvent waiting for an impossible event. Because I encountered that deadlock before, it only blocked the network part of Windows. Like froze the network properties window, stopped you from rebooting and so on. You can still use the other part of Windows.
So why this frozen problem occurs?
Here is all the code of my driver if you like to read:
https://svn.nmap.org/nmap-exp/yang/NPcap-LWF/packetWin7/npf/npf/
The installer and other info are as below:
(Revision 32149)
Entire code base:
https://svn.nmap.org/nmap-exp/yang/NPcap-LWF
The installer only:
https://svn.nmap.org/nmap-exp/yang/NPcap-LWF/installer/winpcap-nmap-4.1.3-NDIS6-1.2.0.exe
Build instructions:
https://svn.nmap.org/nmap-exp/yang/NPcap-LWF/README-builds.txt

TCP/IP Programming in C

I have an exam on tomorrow on TCP/IP programming. Following is one of the previous question on this paper.
Write and run a client and a server program. Using C language in UNIX, with the
following specifications :
• A TCP client program will send a range of number (e.g. 1 to 10) to the server.
• TCP server accept the number range from client and send back the sum of the
number range. Client will print the result.
I dont know how to setup the compiler and other settings to run this tcp ip programs. When I search online, I got two different programs, one for Client and another For server. Some please tell me how can i run these programs to get desired output. What kind of compiler should I install on my system.( I am using windows 7) ??
Since the assignment requires your code to work on a Unix system, you first need to install one. Follow these simple steps to install a virtual Unix environment on top of your existing Windows installation.
Download and install VirtualBox for Windows.
Download & unpack this Ubuntu 12.10 disc image (NOTE: Requires 7-Zip).
Launch VirtualBox and create a new Virtual Machine (name it Ubuntu).
In the "Virtual Hard Disk" settings, select "Use existing hard disk" and select the image file you just downloaded (NOTE: It's filename should end in ".vdi").
Run your new Virtual Machine. You should see the Ubuntu splash screen.
Login with username ubuntu and password reverse (NOTE: Case Sensitive!).
Open up Terminal and type sudo apt-get install build-essential (NOTE: when Terminal prompts you for a password, use reverse).
You should (with hope) have everything you need for your assignment. For more information on network programming, consult Beej's Guide to Network Programming -- Using Internet Sockets.
You need to open two different terminals on your system.
In the first terminal compile and run the server.c program.(make sure either you listen to all ips or your host ip(atleast).
while this is running.(it will wait for a request from your client program)
Run the client program in the other terminal.
Hope this solves the problem!
For details on how to create and run a file in unix refer http://www.wikihow.com/Compile-a-C-Program-Using-the-GNU-Compiler-%28GCC%29
P.S: you can do the same in win7 if iam not wrong only that terminal here in called command prompt!
Post the results if possible!
Download a thing called VMWare player. And look for a Ubuntu image that you can load with the VMWare player. That way, you will have a little Linux virtual machine that you can run inside or along with Windows 7. You can use the compiler GCC in your Ubuntu or whatever other Linux virtual machine. And get lots of coffee. Blargle is correct, but I think my suggestion is a little better, because you end up having a fairly complete Unix type environment to develop in. Blargle's way put Unix tools on top of Windows, which I find to be kind of clunky.
I learnt socket programming from this site. He has given everything in detail . Download an Vmware workstation and load up ubuntu . Understand the programs they are pretty much straight forward .
Maybe you can try to look at Network Socket on the web. You can easily find a lot of good tutorial that can answer your question.
You can use the compiler you want on your system, depending on what are you using now.

Using Xnest between Mac OS X (Snow Leopard) and Ubuntu 10.10

I just installed an Ubuntu 10.10 desktop on a system to do some development work. I would like to run the X server environment on my MacBook instead of keyboard hopping (the graphics system on the Ubuntu box is not so great).
Poking around on the web I uncovered the following command that I can run from a terminal in Mac OS X:
/usr/X11/bin/Xnest -geometry 1280x900 :1 & DISPLAY=:1 ssh -X -Y grog#ubuntusys gnome-session
Note I have ssh set up so authentication happens automatically.
This seems to work great -- the Ubuntu desktop appears on my Mac OS X screen! (It seems to be smart enough to start X11 if it isn't running already). However if I try to open any program, it dies out. So close.
Any suggestions appreciated.
Update: Thanks to the answer below that provides a tutorial link I learned how to do basic X forwarding. You can do this from an X terminal window on the Mac simply like this:
ssh -X -Y username#targetsystem
then you can start X applications that run on the remote system but their windows are on the Mac X server. The issue that I now have is I want to start the gnome desktop session:
gnome-session
but the problem there is that the session takes over the whole Mac desktop. You cannot resize it or move it. Worse, the top part of the windows managed by the window manager end up underneath the menu bar that Mac OS puts up there so you cannot access those controls. I think this is a problem that Xnest was intended to solve, or am I misunderstanding what it is all about?
Use Xnest or Xephyr this way on your Mac OS X:
Xnest :1 -geometry 1280x800 -query 10.0.1.x
Xephyr :1 -screen 1280x1024 -query 192.168.1.x
The only thing you have to do is to enable remote login in your Linux by manually editing /etc/gdm/custom.cfg or using the gdmsetup GUI program. Here CentOS 5 is taken as an example. In Ubuntu things will be a little differrent.
This approach is very different to VNC which is like Microsoft's RDP (screen capture) while XDMCP utilizes the graphic power of your Mac to assist Linux system.
Remember that X11 was specifically designed to be used over network connections rather than on an integral or attached display device. X features network transparency: the machine where an application (the client application, for instance Firefox on Linux) runs can differ from the user's local machine (the display server, that is the X11 on your Mac). This approach allows both 2D and 3D operations to be fully accelerated on the user's local X server.
Depending on which version of OSX you're running, the best bet is probably the native Mac X11 Distribution. It's on the install CD (or if you're like me you got Lion through the App Store, it is available in the Utilities folder by default).
Launching it (Applications > Utilities > X11) brings up a specific X11 x-terminal, which you can use to ssh forward over to your Ubuntu system. That link in Answer 1 is pretty old, I found this one to be more helpful: http://www.craigryder.com/linux-ubuntudebetc/x11-forwarding-and-ssh-for-remote-linux-ubuntu-desktop/
The only extra option I use is the -C flag to enable compression when I run my ssh command. Please note that you do NOT have to run a full gnome-session to use the X features - you can simply run the program you want (ie, $ gedit&). This gets you out of using the whole desktop, but it is kind of weird since your Mac desktop still gets blacked out. You can find more on this technique # http://ubuntuforums.org/showthread.php?t=1373823&page=2
I also noticed that on 10.10 Ubuntu, my system showed the same odd UI control behaviors you mention, but those disappeared when I upgraded my distribution to Ubuntu 11. I didn't really go to deep to see if simply upgrading X to the latest version on the 10.10 Ubuntu system would have fixed that issue, but I can confirm that it does not appear in 11.
One final note, this still seems to force the Mac X11 server into Full-Screen mode, but if you press COMMAND-ALT-A it immediately takes you out of the X desktop and back into your Lion desktop, which allows me to have both running and still be productive when I need to jump out of my Ubuntu system. I seem to be able to always access all the title and menu bars for all of my X apps just as though I was sitting at the Ubuntu desktop.
One caveat - I'm running the above to connect to a VMWare Workstation VM running Ubuntu (with 3D acceleration enabled) on my workstation - connecting to actual hardware may (though I can't fathom how) result in slightly different behavior.
Hope this helped!
Is VNC not working for you?
Or regular X forwarding over SSH.

Eclipse cross-compile... how can I do that?

I am developing on a Windows machine using Eclipse in C code.
All the files are physically located on a Linux server.
I am using Eclipse only for editing and code browsing.
When I want to compile, I open a terminal and telnet to the Linux server from which I call a file that sets up few variables and eventually invoke a "make" command.
The server is pretty busy.. I would then like to be able to compile locally [and then just ftp these executable files back to the Linux machine so that I can execute them.. unless Eclipse can do that on its own :) ].... any idea how can that be done? I am not well versed in Eclipse or OS usage.... so if you could answer and explain what I should do.. I would really appreciate...
I changed the Build Command under Project Properties menu by just calling the script file on the server I usually invoke to compile... That looked fairly simple.. well... that was too good to be true... and of course.. it didn't work! I am getting this error if I use the default "make" (Cannot run program "make": Launching failed).... while getting (Cannot run program "T:\compile": Launching failed) if I try to invoke my script file that I use to compile...
thanks,
You should take a look at running a crosstool-ng setup on your windows box inside cygwin. And then have eclipse use that compiler. This will allow you to develop for your target Linux platform easily.
Here's some slides
It sounds like you're developing for a desktop/server platform, so you'll have to make sure you set up your crosstool-ng with the same versions of standard libs as your server has (libc, libstdc++, etc). You also want to make sure your crosstool-ng has the same version of gcc as the target as well.
If you don't want to mess with getting all that setup, you could always install Linux as a virtual machine on your windows box and work inside there.

Resources