Windows 7 - no network - What do I need to locally fake UNC path for development/testing? - windows

Situation: I'm on a stand-alone development computer running Windows 7. Not connected to any Windows Server. Would like to test a Window application's ability to use UNC paths. Will be transferred later to a Linux server (not at my location), hence the desire to use a cross-platform path mechanism (UNC) (//servername/sharename), rather than a Window's mapped drive (X:\foldername).
The application is Autodesk Maya 2014. A project's main file contains many references to other files. These file references can be relative paths ("subfolder/filename.ext"), absolute paths ("H:/projects/this_project/subfolder/filename.ext"), or UNC paths ("//servername/projects/.." or "servername/assets/..").
The app permits forward slashes, and maps those to the correct character on different OSes. Wherever possible, I use relative paths.
But I have a situation where a plug-in is not correctly working with relative paths, so I have resorted to using some absolute paths. It has been requested that I change these from the current mapped drive form, to UNC paths. REASON: the data will be transferred to a render farm, running Linux. A Linux version of the app will be used. (So my question isn't about accessing Linux files from my Windows box; it is about setting up all the data so that when everything is moved to the render farm, it will still run.)
Due to the combination of plug-ins and features we are using in Maya, I am not 100% certain I can convert all paths to relative form. (Questions there for Maya forums.) So as a fallback, I need to test with UNC paths. Am asking what it would take to set this up on my Windows 7 PC, without actually connecting to a server computer. (Don't have Linux nor Windows Server set-up at my location.)
I don't normally do network-related programming, nor server programming, so the various possible solutions are not familiar to me.
Googling suggests some basic techniques, that may or may not be relevant. Before I spend more time on this, want to know if I am going in the correct/easiest direction.
installing a local DNS server and editing its hosts file. Such as:
http://sourceforge.net/projects/acrylic/
http://sourceforge.net/projects/dhcp-dns-server/
.. but I don't have a domain name, I just have a (future) network computer name, so this is not relevant?
Editing LMHOSTS file
.. but this is just for mapping between a name and an IP address?
multiple NetBIOS names (OptionalNames)
Mentioned here:
http://www.mediamonkey.com/forum/viewtopic.php?t=51722&f=1
Which refers to:
https://serverfault.com/questions/23823/how-to-configure-windows-machine-to-allow-file-sharing-with-dns-alias
.. But that is talking about DNS, so is that relevant?
What I have succeeded in doing so far:
In Command Prompt (Run as Administrator):
net view \\localhost
or
net view \\mycomputernamehere
Lists shared folders on my PC. E.g. H:\temp Properties / Sharing, shared as "HTemp", which is listed.
So I think all I need to do is:
A. Share any folder with the desired name, e.g. "projects".
It will then be visible as "\\localhost\projects".
B. Convince Windows to use my local computer when I ask for "\\servername". I can then use "//servername/projects" in the app, which will ask Windows for "\\servername\projects", which then would be converted by Windows to "\\mycomputernamehere\projects".
... this (B) is the part I need help with. (3) above sounds like it is a solution. But to me it is rather arcane (editing the registry). Will it accomplish what I need? Is there an easy solution that doesn't involve registry editing?
And yes, somewhere along the way it dawned on me that the simplest solution is to rename my computer to "servername". I'll probably do that for this week.
But I'd still like to learn a way to alias my computer name, to fake a UNC path without actually renaming my computer. And without relying on a second computer acting as server.

This is a late answer, but for future reference:
Your suggestion of multiple NetBIOS names (OptionalNames) has worked for me to allow a Windows machine to accept UNC paths under other computer names.
For completess, you can combine this with adding the same alias's to the hosts file with the localhost ip 127.0.0.1 so IP traffic will always be redirected.

Maybe use the UNC version of localhost?
\\localhost\c$\tmp
Will map to your local c:\tmp folder.

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.

How do I modify my development environment to create a network drive alias?

Disclaimers: This question is straddling a weird boundary between coding and SuperUser territory. I'm not even sure what terminology to use for half of what I'm asking so bear with me...
I'm working on a check in/out type of function for a remote client where they want to move some files back and forth between users' local machines and a central network location. They want the network location to be configurable. During the development for the past few weeks we've had the configured directory set to something simple like "C:\Storage" for initial testing purposes, and I created a Storage directory on the C: drive of my dev environment.
Today I got the network configuration they want to start using. I was hoping they'd use a mapped network drive so I could just map the same letter to my local drive and have my dev environment continue to work using their new configuration file. Unfortunately, the path they want to use points directly to some machine on their internal network using "\machinename\dir\dir\dir...".
Is there some way to set up my development environment such that when I encounter their network path using DirectoryInfo or whatever it will resolve to a local directory? If it was a mapped network drive I could use subst at the command prompt to point their letter at a directory on my local drive, but with this full path I don't know how to do something similar or if it's possible.
Now that I understand your problem a little better:
If you want to access your local computer using a UNC path, you'll need to setup a share, which it sounds like you already have. Then you can access it via:
\\localhost\c$\dir\dir
Hopefully that is good enough to get your work done on the dev side.

Shortened filename on Windows with Syntology NAS

Folders on Syntology NAS that contain an accent character are shown shortened on my Windows 7 machine.
i.e
Folder Béla Fleck and The Flecktones is shown in Windows as W:\Music\B39PEX~5
Why is this so, and can I change this so it doesnt happen
If I'm not mistaken this is most certainly Samba server issue. Samba is file accessing, sharing and exchanging protocol. And in most times it doesn't like UTF-8 encoded file names. If you have some old version of Samba installed on your NAS, this could be the answer. Plus: if your NAS runs under Linux and you access it from Windows, an additional problems takes place, as any Windows' Samba client is so poorly written that is has many issues and problems, which you won't find in Samba clients for other systems.
In general, solution is only one: Stop using non-standard characters in your file names and folders. I wasted so many hours on finding similar solution and ended up with a big rename solution to get rid of such "bulky" names.

I installed XAMPP in a virtual drive and now I can't run its services. Why?

The description is quite long. Please spend some time to read it. ^:)^
I have an old PHP application and I'm trying to test and debug it. Unfortunately, the application uses important data so I can't just click this and that. Now, what I'm trying to do is create a copy of the application in a different computer. From now on, I will call the computer running my original PHP application as 'Computer A' and the computer which I'm going to use to run the copy of the application as 'Computer B'.
To prevent missing link problems since the application contains static paths, such in images or tags, I have to copy all files and folder related to my PHP application from Computer A to the same path in Computer B. Unfortunately, Computer B only has drive C while Computer A has drive D and the files of my PHP application is located in 'D:\xampp\htdocs' in Computer A.
OK, now I have to create drive D in computer B. At first, I tried to create a second partition in Computer B by using PowerQuest Partition Magic 8, but somehow Partition Magic doesn't run in Computer B. I have tried to reinstall it but it still doesn't run. So, another alternative is to create a virtual drive. That is what I did. I created a virtual drive by running the 'subst' command in Command Prompt. The virtual drive is D and it refers to a directory, which is 'C:\Virtual'.
After I have drive D in Computer B, I installed XAMPP there. The installation was successful. Now, I also have 'D:\xampp\htdocs' in Computer B. However, when I ran the Apache, MySQL, or Filezilla service, I receive an error message "Error 3: The system cannot find the file specified.". In Computer B, there is no IIS or process using the port 80. What should I do? Please help me.
Many thanks in advance,
Haris
I hope this doesn't constitute cross-posting, here goes...
Subst doesn't instantiate a mount globally, or within the System User / NT Authority, so the server (apache) cannot access it. Apache accesses via the system account, and so it cannot see a subst mount point (so-called).
Following from this: http://msdn.microsoft.com/en-us/library/aa363908%28v=VS.85%29.aspx
...it seems you can instantiate a subst globally via either the win api or possibly directly in the registry using the DefineDosDevice function or method.
Any way you try to do a subst, even using something such as RunAsSystem to attempt to apply the subst command within the system-user context, will fail to produce a viable result.
However, I found that by creating the DosDevice in the registry I have a viable 'subst' mount that apache/mysql/php-win can use. You can also find ways of doing it via wmi, vb, c+, etc, and I do not know if (I doubt) the registry method is directly the same, but here it is...
Example, I want: subst S: C:\PortableUSB
asA.reg file...
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices]
"S:"="\\??\\C:\\PortableUSB"
Or, in the registry it will look like this (so you can manually add it this way)...
A String Name of "S:" (without the quotes. Use your preferred DriveLetter, of course)
This String's Value is "\??\C:\PortableUSB" (without the quotes. Use your own path, of course)
Requires a restart. The subst is persistent and available globally. I do not yet know how reliable it is, but I am using it with success so far.
TwoHawks

How can I debug solutions in Visual Studio 2010 from a network share?

I've recently got a new Mac laptop and am running VS2010 in a Parallels virtual machine. It's mostly working out well for me, but I'm having some problems with debugging specific project types, related to the fact that the projects are being accessed via a network share. Test projects don't run because the test runner can't load the tests' DLL. Web projects fail to run in the Visual Studio mini web server, throwing the following exception:
'An error occurred loading a configuration file: Failed to start monitoring changes to path\to\web.config'.
I've spent the evening trawling the web with little luck on this. After reading these two posts, I tried out the usual CasPol changes, but then found this post from one of the early VS2010 betas indicating that CasPol is no longer needed/supported in .NET 4.0 and VS2010.
The network share is accessible via both a mapped drive and the UNC path. The host for the UNC path is .pfs; according to this post Windows treats host names starting with a dot as originating in the Internet Zone.
The virtual machine runs its applications under the administrator account, which appears to have all the necessary permissions on the network share to create, read, write and delete files and folders. I say "appears to have" as I can't view the Security Properties of the appropriate folder via Explorer: the Security tab just isn't present.
Has anyone managed to successfully load and debug web and test projects from a network share in VS2010?
UPDATE: I tried loading the solutions in VS2010 on a separate native Windows machine using the IP address of my MacBook, with mixed results. The test project again failed to run with the error:
Error loading \\192.168.0.4\alastair\Code\project\bin\Debug\Tests.dll: Could not load file or assembly 'file://\\192.168.0.4\alastair\Code\project\bin\Debug\Tests.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
However, the ASP.NET MVC project runs correctly as expected in this setting, and I get exactly the same results here if I use the NETBIOS name of the MacBook.
Of course, in order to do this, I had to enable SMB sharing in Snow Leopard, which wasn't required to access the location in my Parallels VM. Maybe there's some setting in Parallels that I need to tweak to change permissions on the share?
I've also flagged this question for the moderators to request it be moved to StackOverflow; I think it might be a more appropriate forum than SuperUser.
Try setting <loadFromRemoteSources enabled="true"/> under the runtime element of devenv.exe.config, as suggested in the answer to this question. It fixed the issue for me... Visual Studio still warns me when loading a project from the share, but running tests now works.
This assumes the issue is really with Windows "treat[ing] host names starting with a dot as originating in the Internet Zone". It may be something else, but option (3) below should be a quick means of (dis)proving this as part of the problem.
The period (.) is not an oft-used character in a DNS hostname; it's usually interpreted as a separator between hostname and domainname (eg, localhost.localdomain). DNS hostnames are generally restricted to "LDH" -- Letters, Digits, and Hyphens.
UNC paths and Windows Networking (NetBIOS) names may suffer from similar problems. According to RFC3696, periods are legal, but you need to escape periods used within a hostname according to RFC1035. If I'm reading RFC1035 correctly, your hostname should be \.pfs instead of .pfs.
I'd wonder if your issues would work OK if you
changed the hostname (on the share server) to something not including a dot (and updated the client accordingly),
changed the UNC path to the share (on the client) to use the proper escape sequence for periods, or
changed the UNC path to the share (on the client) to use the IP address instead of the hostname.

Resources