Silverlight 5 Trusted Mode. Accessing FileSystem and Local drives - windows

Is there any way, any chance at all to access entire filesystem in SL app with elevated trust?
That will work both in Windows and Mac?
Through AutomationFactory,PInvoke or unmanaged code?
I need an app that could read local drives, folders and files.
UDP: Ok, seems it's possible to read folders and files using classes of System.IO from mscorlib. Although you still can't get information about local mounted drives. There is no DriveInfo in Silverlight's mscorlib :(

Ok I have an idea about this.
It is straightforward enough with Windows, to get the list of the local drives you can use AutomationFactory. There is plenty amount of examples if you google it. Search for something called SilverlightFileExplorer.
Now on a Mac you can use Directory.EnumerateDirectories("/") and then it gets all the folders in the root. Including Volumes folder which contains shortcuts to the local drives. I'm not an expert of Berkeley System Distribution (BSD) Unix filesystems, so I can't really promise that it would work on any Mac, but this approach works on mine.
I'm still playing around with that. When I get working prototype I'll probably share it through github or something.

Related

How to query if a particular folder is shared or enumerate folders shared from the local machine on osx in C/C++ or Objective C

I'm currently developing on macOS High Sierra (not Windows) using Qt. Just using regular macOS rather than macOS server. I'm happy to write Mac-only code outside the Qt bubble to fix this problem, obviously.
I'm looking for a way to programmatically check in C/C++ or Objective-C whether a particular local folder is shared on the local network. Alternatively I'd like to retrieve a list of all shared folders. I'd like the method to work on a reasonably large range of macOS versions e.g. 10.9 to 10.14.
I need to do this in order to rewrite paths to local files as UNC paths so that they are accessible from a Windows client machine on the same network via SMB sharing with suitable credentials. This does assume shared folders have already been setup but if they haven't the user will receive an error and be prompted to share suitable folders.
I can share/un-share and see the sharing status of a folder using the Get Info dialog in Finder but I'm looking for something I can use within an application.
Things I've tried without success:
Searching for other instances of the problem
NSURL class - doesn't document a resource name to query for its sharing status.
smbutil doesn't seem to list shares being shared from the machine it's running on.
smbd doesn't seem to have any command line options to query shared folders.
The various configuration files mentioned in the smbutil and smbd.conf man pages don't contain a list of shared folders
mdls doesn't contain any relevant metadata in the output for folders that are shared.
ls -l# doesn't list any extra information for shared folders
Sharing an unusually named folder and greping the hard disk for the folder name including binary files to see if this information is persisted somewhere. Presumably it is persisted somehow because the folder is shared after rebooting but I can't find any record of the folder name anywhere.
OpenDirectory services seem to contain lots of references to SMB in the headers but I can't see a way to use OpenDirectory to get a list of folders shared from the local machine.
Sharing the root folder so that the rewriting is trivial. This works but it's pretty undesirable to share a root folder.
Perhaps there's a better way of doing the access that will sidestep the need for having and querying SMB shares...?
Found the answer elsewhere on stackexchange answered by mivk.
Run the following command and capture the output.
sharing -l
This gives a slightly verbose list of file shares with separate details for afp and smb which can be parsed to get a list of shared folders on the local machine. Tested on Catalina. It's possible that this command will fail to run if file sharing is not enabled in System Preferences.

Filesharing between OS X & Windows 10 on a htdocs directory?

I had a practical question for my own work at home. I want to use quad monitor for my coding and other work. I can do this with my macbook pro attached to external triple monitor. But it is not practical because of all the cable management and Macbook Pro is barely keeping up with the performance running it. So what I wanted to do was having my PC run triple monitor and my Macbook as forth screen. Code on my pc and share/update the files in the htdocs directory on my OS X. Like how FTP works.
I found this link: http://www.itworld.com/article/2844141/how-to-share-mac-os-x-yosemite-files-with-windows-10.html
But I'm not sure if I will face sudden obstacles in doing this with my htdocs directory or other directories where my work is stored and updated from time to time.(example:Symfony projects)
I hope I mentioned everything. Thanks in advance!
Well, you can use one of the free cloud based, file-sharig service, like Microsoft OneDrive, Google Drive or Dropbox.
But files will not be updated immediately, you need to wait few seconds (in the best case scenario). So it might get frustrating quickly.
Also, from my experience, OneDrive on Mac is not the best choice when it comes to a Symfony project - it stops working after a while, probably because a lot of cache files, so I need to restart it and it's not usable at all.
Another solution might be using a version control system (f.e. Git) - but you would be able to see the code changes only after a commit and push (and do it manually, of course).

How to recover the deleted or moved data from a particular directory in Linux Environment?

I accidentally moved some files from /home/name/Pictures/ directory from my opensuse 11.4 machine to flash drive. Is there a way to recover the data? I lost the data from my flash drive.
Probably no.
Many (most?) Linux desktops have a "wastebasket". If you delete files using the GUI, you should be able to recover them from the wastebasket GUI:
There are also tools like TestDisk or ExtUndelete that might be able to help you:
http://www.linux.org/threads/undelete-files-on-linux-systems.4316/
http://extundelete.sourceforge.net/
Finally, here are some other links that might (might!) help:
http://www.linux.org/threads/undelete-files-on-linux-systems.4316/
https://superuser.com/questions/150027/how-to-recover-a-removed-file-under-linux
https://help.ubuntu.com/community/DataRecovery
http://www.smashingapps.com/2011/08/11/5-must-have-file-recovery-tools-for-linux-users.html
But frankly, your best choices for Linux are the same as for Windows: keep backups of anything you really care about!

Starting a file server (possibly NFSD) in snow leopard without requiring root?

I want my OS X app to share files via the loopback device. I want to do this so that my app can make a directory of frequently changing, read only files available to the user without messing with the users home directory. The files will be severed from the Application Support directory but the user will not have to concern themselves with this.
Apple recommend using an NFS server to do this (see the 'alternatives' section of this Q&A):
http://developer.apple.com/mac/library/qa/qa2001/qa1242.html
As far as I can tell nfsd must be ran as root, which I'd prefer to avoid (asking the user for a password whenever the app starts would be a horrible UX).
Is it possible to start an nfsd instance without root?
Are there any alternative NFS servers which I could include with the app? (I couldn't find any)
Are there any alternatives servers that I could use? (The server would have to be AFP, SMB or WebDAV as these are the protocols that Finder can mount - I couldn't find any such servers).
I'm not sure I understand your use case but have you considered using a file system mounted from an OS X disk image? Disk images on OS X are very robust and very flexible: you can pretty much have any kind of file system(s) created on one image and can mount or dismount them at will and at whatever mount point(s) you like. See the man page for hdiutil for more info.
If the "files" you are trying to serve are not actually disk files, then you might want to look at MacFUSE, the mostly widely used implementation of FUSE for OS X.
Use MacFUSE. This is by far the easiest way to implement a file system.

Windows Home Server backup solution

I admit this is not strictly a programming question, although I do use my WHS as a source repository server for home projects, and I'm guessing many other coders here do as well.
Does anyone have a recommendation for a good backup solution for the non-fileshare portion of Windows Home Server? All the WHS backups I've seen handle the fileshares, but none of the system files or other administrative stuff on the box.
Thanks,
Andy
Windows Home Server is designed to not need a backup of the OS. If your system drive fails, install a new drive, and then boot the WHS OS setup disc and install the OS. It will find the data on the other drives and recreate all the shared folders. You do need to do some configuring once it is back up but that is pretty small compared to not having to back it up.
One good solution for backing up the home server itself is to attach an external drive, say via USB 2.0 or eSATA. For this to work, though, you need the supporting software like Norton Ghost or something similar installed on your WHS server.
Windows Home Server Power Pack 1 (aka WHS PP1) added a feature to perform backups of the WHS shared folders to an external drive -- as you mention, this feature is only intended to do the data side and not the OS.
If you have an HP MediaSmart server, you could try the method mentioned in Quick & Easy Windows Home Server Backup and Restore. The author said it worked for him, but of course, caveat emptor. This technique has you creating a disk-image for your backup, and using that to restore from in the Recovery Disk / Restore disk process.
If you want a faster way to recover your OS and you do not have a Media Smart server, you can also check out these instructions on how to use a USB flash drive for installing WHS, and merge in the instructions found above for restoring a disk image vis-à-vis the OS Recovery disk process.
WHS OS backup solved by running two copies of WHS each on its own computer in a virtual machine with each WHS backing up the other (running in a VM makes the WHS a file thus able to be backed up and restored by WHS).
iDrive is Great and free under 2 gigs

Resources