How to set 660 permission on file using c prgram on windows platform? - permissions

I wanted to set 660 permission on file using c program on both linux and windows platform.
Using c program which runs on linux platform we can use chmod function where we can set permission bit S_IRUSR | S_IWRITE | S_IRGRP | S_IWGRP which mimic/set 660 permission on file.
Code snippet:
#define FILE_PERM (S_IRUSR | S_IWRITE | S_IRGRP | S_IWGRP)
chmod(file_name, FILE_PERM);
which set 660 file permission on linux platform successfully.
On windows platform:
I have found only 2 bit _S_IRUSR | _S_IWRITE which makes file either readonly or rdwr only.
Not able to mimic / set 660 permission on file on windows platform just like linux.
Tried apporaches:
I have tried to open file using below function as well:
open(fd, "O_CREATE|O_RDWR", 0660)
But didn't work.
Tried ICACL utility as well but that didn't work as well.
Please let me know is there anyway to set 660 permission on file on windows platform using c program?

Related

Error message while trying to install Tensorflow for GPU using Anaconda

I am trying to install Tensorflow for GPU using Anaconda on my Windows 10 system. Running
conda create --name tf_gpu tensorflow-gpu
I get:
Downloading and Extracting Packages
tensorflow-base-1.12 | 180.8 MB | #########################################################1 | 75%
[Errno 2] No such file or directory: 'C:\\Users\\miroslaw.bartkowiak\\AppData\\Local\\Continuum\\anaconda3\\pkgs\\tensorflow-base-1.12.0-gpu_py36h6e53903_0\\Lib\\site-packages\\tensorflow\\include\\tensorflow\\include\\external\\eigen_archive\\unsupported\\Eigen\\src\\SpecialFunctions\\arch\\CUDA\\CudaSpecialFunctions.h'
I'd appreciate your help ...
I believe your problem is Windows long path name support.
For some reason MS leave it off.
For Windows 10 Pro or above, run the Local Group Policy Editor (gpedit).
Go to Computer Configuration -> Administrative Templates -> System -> Filesystem.
Change the Enable Win32 long paths setting to Enabled and reboot.
For Windows 10 Home, you have to change the registry.
Hive: Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
Set LongPathsEnabled to 1
Reboot.
Then try again.
Good luck!

Can I run a query, using BQ command line tool, from a file in Windows command prompt?

I saw this question, but the answer given was applicable only to Linux/Mac. I know this works in Powershell. Is there a way to do this same thing on Windows using the Command Prompt?
Try as below
C:\Program Files (x86)\Google\Cloud SDK>echo SELECT 'Hello' > qq.txt
C:\Program Files (x86)\Google\Cloud SDK>bq query < qq.txt
Waiting on bqjob_r56213d80_0000015b20a3b653_1 ... (0s) Current status: DONE
+-------+
| f0_ |
+-------+
| Hello |
+-------+
C:\Program Files (x86)\Google\Cloud SDK>
This was run in Google Cloud SDK Shell on Win

Display what file has been automatically uploaded by PyCharm / IntelliJ-based IDE

There's a nice feature in PyCharm / IntelliJ for automatic upload of changed files to remote machine. However, the message is cryptic:
Automatic upload completed in less than a minute: 1 file transferred (7.7 Kb/s)
It does not say what files were actually uploaded. Can this be configured somehow?
Tools | Deployment | Options (or the same via Settings (Preferences on Mac) | Build, Execution, Deployment | Deployment | Options) -- change "Operations logging" to "Details".

How to run C .exe file in auto run by USB?

I have a c program(i.e .exe) , i want to execute that program through USB in auto run mode, when USB is on then file should run . I make it auto run file i.e autorun.inf .Inside auto run file the content is
[autorun] action=v1.exe open=v1.exe
but it is not working .
What operating system are you using? I thought auto run was disabled in windows 7. See : http://blogs.technet.com/b/srd/archive/2009/04/28/autorun-changes-in-windows-7.aspx
Read this if you are using win 7 AutoRun changes in Windows 7
more over this kind of activity is using by malware so try to avoid, otherwise you will loos your trust level.

The procedure entry point CryptStringToBinaryW could not be located in the dynamic link library CRYPT32.dll

Can't install DVD-RW drive. An error occurs:
The procedure entry point CryptStringToBinaryW could not be located in the
dynamic link library CRYPT32.dll"
How to manage it on Windows 2000 SP4?
Surfing the web found only this
http://www.daniweb.com/forums/thread146113.html
and this
http://www.derkeiler.com/Newsgroups/microsoft.public.platformsdk.security/2003-11/0556.html
Installing kiwee_toolbar_installer.exe really produces this error.
Also using new usb devices cause it happen.
According to Microsoft's documentation for CryptStringToBinary(), the minimum operating system requirements are:
Client: Windows XP
Server: Windows Server 2003
So, basically you can't use those drivers on Win2K SP4.
CryptStringToBinary is supported on Windows XP on up, not Windows 2000. Software that requires this function will not run on Windows 2000 SP4. There is no workaround. You need to contact the creators of the app to ask for Windows 2000 support.
Yeah, thank you. One more reason for upgrade to newer Windows versions :)
Or may be just do sfc /scannow and overtake this DLL-hell?
Finally, I've manage to get rid of this error message and my DVD-RW was installed flawlessly after that :) Step by step:
1) sfc /scannow restored some files but this doesn't help
2) when looking for devices in Device Manager window Process Monitor by Mark Russinovich revealed this:
2130 14:00:47,6636859 System 8 RegQueryKey HKLM\System\CurrentControlSet\Services\ElbyDelay BUFFER TOO SMALL Query: Basic, Length: 0
2131 14:00:47,6638242 System 8 RegQueryKey HKLM\System\CurrentControlSet\Services\ElbyDelay BUFFER TOO SMALL Query: Basic, Length: 0
2132 14:00:47,7063290 System 8 IRP_MJ_CREATE C:\WINNT\system32\drivers\ElbyDelay.sys NAME NOT FOUND Desired Access: Execute/Traverse, Disposition: Open, Options: , Attributes: n/a, ShareMode: Read, Delete, AllocationSize: n/a
2133 14:00:47,7067271 System 8 IRP_MJ_CREATE C:\WINNT\system32\drivers\ElbyDelay.sys NAME NOT FOUND Desired Access: Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
I remembered that some time ago beta version of Virtual Clone Drive was uninstalled.
3) lastly I've delete occurences for "ElBy" using Device Manager (show hidden devices) and regedit.